about summary refs log tree commit diff
path: root/codechef/maxep.c
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2018-12-12 01:10:38 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2018-12-12 01:10:38 +0700
commit5e48d2ec45a065cc81781995bf461415563da086 (patch)
tree89c213a2d47bcf7790b3cc4873c81fd8c1ccefc8 /codechef/maxep.c
parent054428243ccb1c0b39c7fdf8faa449ce415789ce (diff)
downloadcp-5e48d2ec45a065cc81781995bf461415563da086.tar.gz
maxep is only 25% AC )-:
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;
+}