about summary refs log tree commit diff
path: root/codechef/maxep.c
diff options
context:
space:
mode:
Diffstat (limited to 'codechef/maxep.c')
-rw-r--r--codechef/maxep.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/codechef/maxep.c b/codechef/maxep.c
new file mode 100644
index 0000000..e92d9df
--- /dev/null
+++ b/codechef/maxep.c
@@ -0,0 +1,26 @@
+#include <stdio.h>
+
+int main()
+{
+	long x = 1, y, n;
+	int b, c, left = 1000;
+
+	scanf("%ld %d", &n, &c);
+	while (--left >= c && x < n) {
+		printf("1 %ld\n", y = (x + n) / 2);
+		fflush(stdout);
+
+		scanf("%d", &b);
+		if (b) {
+			puts("2");
+			fflush(stdout);
+			left -= c;
+			n = y;
+		} else {
+			x = y + 1;
+		}
+	}
+
+	printf("3 %ld\n", x);
+	return 0;
+}