Submission #430923

# Submission time Handle Problem Language Result Execution time Memory
430923 2021-06-17T08:01:48 Z tengiz05 Aliens (IOI07_aliens) C++17
100 / 100
5 ms 328 KB
#include <bits/stdc++.h>
using i64 = long long;
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    i64 n, x, y;
    std::cin >> n >> x >> y;
    auto ask = [&](i64 x, i64 y) {
        if (x <= 0 || y <= 0 || x > n || y > n) {
            return false;
        }
        std::cout << "examine " << x << " " << y << std::endl;
        std::string res;
        std::cin >> res;
        return res == "true";
    };
    for (int i = 2; ; i *= 2) {
        if (!ask(x, y + i)) {
            for (int j = i / 2; j > 0; j /= 2) {
                if (ask(x, y + j)) {
                    y += j;
                }
            }
            break;
        }
    }
    for (int i = 2; ; i *= 2) {
        if (!ask(x + i, y)) {
            for (int j = i / 2; j > 0; j /= 2) {
                if (ask(x + j, y)) {
                    x += j;
                }
            }
            break;
        }
    }
    i64 X = x, Y = y;
    for (int i = 2; ; i *= 2) {
        if (!ask(X, Y - i)) {
            for (int j = i / 2; j > 0; j /= 2) {
                if (ask(X, Y - j)) {
                    Y -= j;
                }
            }
            break;
        }
    }
    i64 len = y - Y + 1;
    // std::cout << X << " " << Y << "\n";
    // std::cout << len << std::endl;
    while (ask(x + len, y + len)) {
        x += len;
        y += len;
    }
    while (ask(x, y + len * 2)) {
        y += len * 2;
    }
    while (ask(x + len * 2, y)) {
        x += len * 2;
    }
    std::cout << "solution " << x - len * 2 - len / 2 << " " << y - len * 2 - len / 2 << std::endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 328 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
3 Correct 3 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 200 KB Output is correct
2 Correct 5 ms 200 KB Output is correct
3 Correct 3 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
3 Correct 2 ms 200 KB Output is correct