Submission #348701

# Submission time Handle Problem Language Result Execution time Memory
348701 2021-01-15T14:52:42 Z apostoldaniel854 Aliens (IOI07_aliens) C++14
0 / 100
1000 ms 364 KB
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
#define pb push_back
#define dbg(x) cerr << #x << " " << x << "\n"

int n;

bool ask (int x, int y) { /// if the grass on (x, y) is flattened
    if (x <= 0 || y <= 0 || x > n || y > n)
        return false;
    cout << "extract " << x << " " << y << endl;
    string answer;
    cin >> answer;
    if (answer == "true")
        return true;
    return false;
}
int dx[] = {1, 1, -1, -1};
int dy[] = {1, -1, 1, -1};
int main() {
    int xn, yn;
    cin >> n >> xn >> yn;
    int sz = 0;
    int x = xn, y = yn;
    while (ask (x, y + (1 << sz)))
        sz++;
    sz--;
    int y2 = y;
    while (sz >= 0) {
        if (ask (x, y2 + (1 << sz)))
            y2 += (1 << sz);
        sz--;
    }
    sz = 0;
    while (ask (x, y - (1 << sz)))
        sz++;
    sz--;
    int y1 = y;
    while (sz >= 0) {
        if (ask (x, y1 - (1 << sz)))
            y1 -= (1 << sz);
        sz--;
    }

    sz = 0;
    while (ask (x + (1 << sz), y))
        sz++;
    sz--;
    int x2 = x;
    while (sz >= 0) {
        if (ask (x2 + (1 << sz), y))
            x2 += (1 << sz);
        sz--;
    }
    sz = 0;
    while (ask (x - (1 << sz), y))
        sz++;
    sz--;
    int x1 = x;
    while (sz >= 0) {
        if (ask (x1 - (1 << sz), y))
            x1 -= (1 << sz);
        sz--;
    }
    int m = x2 - x1 + 1;
    int x_mid = (x2 - x1 + 1) / 2;
    int y_mid = (y2 - y1 + 1) / 2;
    bool moved = true;
    do {
        moved = true;
        for (int dir = 0; dir < 4; dir++)
            if (ask (x_mid + 3 * m * dx[dir], y_mid + 3 * m * dy[dir])) {
                x_mid += m * dx[dir];
                y_mid += m * dy[dir];
                moved = true;
            }
    } while (moved);
    cout << "solution " << x_mid << " " << y_mid << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3092 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3096 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3031 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3045 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -