Submission #1154629

#TimeUsernameProblemLanguageResultExecution timeMemory
1154629YSH2020Aliens (IOI07_aliens)C++20
40 / 100
1 ms416 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, x1, y1; cin >> n >> x1 >> y1;
    int left = x1;
    int right = x1;
    while (left > 1) {
        cout << "examine " << left-1 << ' ' << y1 << endl;
        string x; cin >> x;
        if (x == "false") break;
        left--;
    }
    while (right < n) {
        cout << "examine " << right+1 << ' ' << y1 << endl;
        string x; cin >> x;
        if (x == "false") break;
        right++;
    }
    //so now the size is right-left+1
    int size=(right-left+1);
    x1 = (right+left)/2;
    int high = y1;
    while (high > 1) {
        cout << "examine " << x1 << ' ' << high-1 << endl;
        string x; cin >> x;
        if (x == "false") break;
        high--;
    }
    int low = high+size-1;
    //so now the size is right-left+1
    y1 = (high+low)/2;
    //so now you have the center of that square, so we bash out the rest
    int left2 = x1;
    int right2 = x1;
    while (left2 > 2*size) {
        cout << "examine " << left2-2*size << ' ' << y1 << endl;
        string x; cin >> x;
        if (x == "false") break;
        left2 -= 2*size;
    }
    while (right2 <= n-2*size) {
        cout << "examine " << right2+2*size << ' ' << y1 << endl;
        string x; cin >> x;
        if (x == "false") break;
        right2 += 2*size;
    }
    int high2 = y1;
    int low2 = y1;
    while (high2 > 2*size) {
        cout << "examine " << x1 << ' ' << high2-2*size << endl;
        string x; cin >> x;
        if (x == "false") break;
        high2 -= 2*size;
    }
    while (low2 <= n-2*size) {
        cout << "examine " << x1 << ' ' << low2+2*size << endl;
        string x; cin >> x;
        if (x == "false") break;
        low2 += 2*size;
    }
    left2 = (x1-left2)/(2*size);
    right2 = (right2-x1)/(2*size);
    high2 = (y1-high2)/(2*size);
    low2 = (low2-y1)/(2*size);
    x1 += (right2-left2)*size;
    y1 += (low2-high2)*size;
    cout << "solution " <<  x1 << ' ' << y1 << endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...