# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
288228 | 2020-09-01T10:35:48 Z | Kastanda | Aliens (IOI07_aliens) | C++11 | 2 ms | 404 KB |
// M #include<bits/stdc++.h> using namespace std; typedef long long ll; ll n, m, nwx, nwy; int main() { scanf("%lld%lld%lld", &n, &nwx, &nwy); map < pair < ll , ll > , bool > MP; auto Query = [&](ll a, ll b){ if (a < 1 || a > n || b < 1 || b > n) return false; if (MP.count({a, b})) return MP[make_pair(a, b)]; printf("examine %lld %lld\n", a, b); fflush(stdout); char ss[7]; scanf("%s", ss); MP[make_pair(a, b)] = ss[0] == 't'; return (bool)(ss[0] == 't'); }; { ll lg = 0; while (Query(nwx - (1LL << lg), nwy)) lg ++; ll left_gap = 0; for (ll i = lg - 1; i >= 0; i --) if (Query(nwx - left_gap - (1LL << i), nwy)) left_gap |= 1LL << i; lg = 0; while (Query(nwx + (1LL << lg), nwy)) lg ++; ll right_gap = 0; for (ll i = lg - 1; i >= 0; i --) if (Query(nwx + right_gap + (1LL << i), nwy)) right_gap |= 1LL << i; m = right_gap + left_gap + 1; assert(m >= 3 && m & 1LL); nwx -= left_gap; lg = 0; while (Query(nwx, nwy - (1LL << lg))) lg ++; ll down_gap = 0; for (ll i = lg - 1; i >= 0; i --) if (Query(nwx, nwy - down_gap - (1LL << i))) down_gap |= 1LL << i; nwy -= down_gap; while (Query(nwx - m * 2LL, nwy)) nwx -= m * 2LL; if (Query(nwx - m, nwy - m)) nwx -= m, nwy -= m; while (Query(nwx, nwy - m * 2LL)) nwy -= m * 2LL; nwx += m * 2 + m / 2; nwy += m * 2 + m / 2; printf("solution %lld %lld\n", nwx, nwy); fflush(stdout); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 372 KB | Output is correct |
2 | Correct | 2 ms | 372 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 404 KB | Output is correct |
2 | Correct | 2 ms | 372 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |