# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
91672 | 2018-12-29T06:16:08 Z | ics0503 | Aliens (IOI07_aliens) | C++17 | 3 ms | 380 KB |
#include<stdio.h> #include<string.h> long long min(long long a, long long b) { if (a < b)return a; return b; } bool qr(long long x, long long y) { printf("examine %lld %lld\n", x, y); fflush(stdout); char X[10]; scanf("%s", X); if (strcmp(X, "true") == 0)return 1; return 0; } void sol(long long x, long long y) { printf("solution %lld %lld\n", x, y); fflush(stdout); } int main() { long long n, x0, y0; scanf("%lld%lld%lld", &n, &x0, &y0); long long sx, sy, ex, ey, i, j, bef; bef = x0; for (i = 0;; i++) { long long x = x0 + (1ll << i); if (x > n)x = n; if (x == n || qr(x, y0) == 0) { long long s = bef, e = x; while (s <= e) { long long m = (s + e) / 2; if (qr(m, y0))s = m + 1, ex = m; else e = m - 1; } break; } bef = x; } bef = y0; for (i = 0;; i++) { long long y = y0 + (1ll << i); if (y > n)y = n; if (y == n || qr(x0, y) == 0) { long long s = bef, e = y; while (s <= e) { long long m = (s + e) / 2; if (qr(x0, m))s = m + 1, ey = m; else e = m - 1; } break; } bef = y; } bef = x0; for (i = 0;; i++) { long long x = x0 - (1ll << i); if (x <= 0)x = 1; if (x == 1 || qr(x, y0) == 0) { long long s = x, e = bef; while (s <= e) { long long m = (s + e) / 2; if (qr(m, y0))e = m - 1, sx = m; else s = m + 1; } break; } bef = x; } bef = y0; for (i = 0;; i++) { long long y = y0 - (1ll << i); if (y <= 0)y = 1; if (y == 1 || qr(x0, y) == 0) { long long s = y, e = bef; while (s <= e) { long long m = (s + e) / 2; if (qr(x0, m))e = m - 1, sy = m; else s = m + 1; } break; } bef = y; } long long m = (ex - sx + 1); while (sx>m&&sy>m&&qr(sx - m, sy - m))sx -= m, sy -= m, ex -= m, ey -= m; while (sx>2*m&&qr(sx - 2 * m, sy))sx -= 2 * m, ex -= 2 * m; while (sy>2*m&&qr(sx, sy - 2 * m))sy -= 2 * m, ey -= 2 * m; sol((2 * sx + 5 * m - 1) / 2, (2 * sy + 5 * m - 1) / 2); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 244 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 276 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 2 ms | 248 KB | Output is correct |