Submission #572742

# Submission time Handle Problem Language Result Execution time Memory
572742 2022-06-05T07:30:03 Z snasibov05 Aliens (IOI07_aliens) C++14
20 / 100
5 ms 288 KB
#include <bits/stdc++.h>

using namespace std;

bool ask(int x, int y){
    cout << "examine " << x << " " << y << endl;
    string str; cin >> str;
    if (str == "true") return true;
    else return false;
}

int main() {
    int n, x0, y0; cin >> n >> x0 >> y0;

    int xt = x0, yt = y0, xb = x0, yb = y0;
    while (xt > 1 && ask(xt-1, y0)) xt--;
    while (xb < n && ask(xb+1, y0)) xb++;
    while (yt > 1 && ask(x0, yt-1)) yt--;
    while (yb < n && ask(x0, yb+1)) yb++;

    int sz = xb - xt + 1;

    while (true){
        if (xt-sz >= 1 && yt - sz >= 1 && ask(xt - sz, yt - sz)) xt = xt - sz, yt = yt - sz;
        else if (xt + sz <= n && yt - sz >= 1 && ask(xt + sz, yt - sz)) xt = xt + sz, yt = yt - sz;
        else break;
    }

    int xres = xt + 2*sz + sz / 2;
    int yres = yt + 2*sz + sz / 2;
    cout << "solution " << xres << " " << yres << endl;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 288 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Runtime error 2 ms 208 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Runtime error 4 ms 208 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -