제출 #1339068

#제출 시각아이디문제언어결과실행 시간메모리
1339068vjudge1Aliens (IOI07_aliens)C++17
0 / 100
1 ms420 KiB
#include <bits/stdc++.h>

using namespace std;

void solve(){
    long long n, x0, y0;
    cin >> n >> x0 >> y0;
    long long r = 0;
    vector<bool> in = {true};
    long long i = 0;
    while (in[i]){
        r++;
        i++;
        if (x0+r <= n){
            cout << "examine " << x0+r << " " << y0 << endl;
            string temp;
            cin >> temp;
            if (temp == "true") in.push_back(true);
            else in.push_back(false);
        }
        else in.push_back(false);
    }
    r--;
    long long l = 0;
    in[i] = true;
    while (in[i]){
        i++;
        l++;
        if (x0-l > 0){
            cout << "examine " << x0-l << " " << y0 << endl;
            string temp;
            cin >> temp;
            if (temp == "true") in.push_back(true);
            else in.push_back(false);
        }
        else in.push_back(false);
    }
    l--;
    long long m = l+r+1;
    long long cx0 = x0-l+(m/2), cy0 = y0-l+(m/2);
    vector<bool> inc;
    for (long long y = m; y >= -m; y -= 2*m){
        for (long long x = -m; x <= m; x += 2*m){
            if (cx0+x <= n && cx0+x > 0 && cy0+y <= n && cy0+y > 0){
                cout << "examine " << cx0+x << " " << cy0+y << endl;
                string temp;
                cin >> temp;
                if (temp == "true") inc.push_back(true);
                else inc.push_back(false);
            }
            else inc.push_back(false);
        }
    }
    long long xc = cx0, yc = cy0;
    if (inc[0] && inc[1] && inc[2] && inc[3]){
        vector<bool> inb;
        for (long long x = -m; x <= m; x += 2*m){
            if (cx0+2*x <= n && cx0+2*x > 0){
                cout << "examine " << cx0+2*x << " " << cy0 << endl;
                string temp;
                cin >> temp;
                if (temp == "true") inb.push_back(true);
                else inb.push_back(false);
            }
            else inb.push_back(false);
        }
        for (long long y = m; y >= -m; y -= 2*m){
            if (cy0+2*y <= n && cy0+2*y > 0){
                cout << "examine " << cx0 << " " << cy0+2*y << endl;
                string temp;
                cin >> temp;
                if (temp == "true") inb.push_back(true);
                else inb.push_back(false);
            }
            else inb.push_back(false);
        }
        long long xc = cx0, yc = cy0;
        if (inb[0]) xc -= m;
        if (inb[1]) xc += m;
        if (inb[2]) yc += m;
        if (inb[3]) yc -= m;
        cout << "solution " << xc << " " << yc << endl;
        return;
    }
    else {
        if (inc[0]){
            xc -= 2*m;
            yc += 2*m;
        }
        if (inc[1]){
            xc += 2*m;
            yc += 2*m;
        }
        if (inc[2]){
            xc -= 2*m;
            yc -= 2*m;
        }
        if (inc[3]){
            xc += 2*m;
            yc -= 2*m;
        }
        if (xc == cx0-4*m) xc += 2*m;
        if (xc == cx0+4*m) xc -= 2*m;
        if (yc == cy0-4*m) yc += 2*m;
        if (yc == cy0+4*m) yc -= 2*m;
        cout << "solution " << xc << " " << yc << endl;
        return;
    }
}

int main(){
    // ios_base::sync_with_stdio(0);
    // cin.tie(0);
    // long long t;
    // cin >> t;
    // while (t--) solve();
    solve();
    return 0;
}
#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...