답안 #808790

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
808790 2023-08-05T11:04:36 Z Liudas Aliens (IOI07_aliens) C++17
0 / 100
3 ms 208 KB
#include <iostream>
using namespace std;
int main()
{
    long long N, x, y;
    cin >> N >> x >> y;
    long long u = 0, l = 0, r = 0, d = 0;
    long long ar = 1, al = 1, au = 1, ad = 1;
    bool flat = true;
    while(ar && x + r + ar <= N){
        cout << "examine " << x + r + ar << " " << y << endl;
        string ans;
        cin >> ans;
        if(ans != "true"){
            flat = false;
            ar /= 2;
            r += ar;
        }
        else{
            ar *= 2;
        }
        if(x + r + ar > N){
            ar /= 2;
            r += ar;
        }
        while(x + r + ar > N){
            ar/=2;
        }
    }
    flat = true;
    while(al && x - l - al >= 1){
        cout << "examine " << x - l - al << " " << y << endl;
        string ans;
        cin >> ans;
        if(ans != "true"){
            flat = false;
            al/=2;
            l += al;
        }
        else{
            al *= 2;
        }
        if(x - r - ar < 1){
            al /= 2;
            l += al;
        }
        while(x - l - al < 1){
            al/=2;
        }
    }
    flat = true;
    while(au && y + u + au <= N){
        cout << "examine " << x << " " << y + u + au << endl;
        string ans;
        cin >> ans;
        if(ans != "true"){
            flat = false;
            au /= 2;
            u += au;
        }
        else{
            au *= 2;
        }
        if(y + u + au > N){
            au /= 2;
            u += au;
        }
        while(y + u + au > N){
            au/=2;
        }
    }
    flat = true;
    while(ad && y - d - ad >= 1){
        cout << "examine " << x << " " << y - d - ad << endl;
        string ans;
        cin >> ans;
        if(ans != "true"){
            flat = false;
            ad /= 2;
            d += ad;
        }
        else{
            ad *= 2;
        }
        if(y - d - ad < 1){
            ad /= 2;
            d += ad;
        }
        while(y - d - ad < 1){
            ad/=2;
        }
    }
    long long midx = (2 * x + r - l) / 2, midy = (2 * y + u - d) / 2;
    long long s = r + l + 1;
    long long cl = 0, cr = 0, cu = 0, cd = 0;
    flat = true;
    while(flat && midx + 2 * s * (cr + 1) <= N){
        cout << "examine " << midx + 2 * s * (cr + 1) << " " << midy  << endl;
        string ans;
        cin >> ans;
        if(ans != "true"){
            flat = false;
        }
        else{
            cr++ ;
        }
    }
    flat = true;
    while(flat && midx - 2 * s * (cl + 1) >= 1){
        cout << "examine " << midx - 2 * s * (cl + 1) << " " << midy  << endl;
        string ans;
        cin >> ans;
        if(ans != "true"){
            flat = false;
        }
        else{
            cl++ ;
        }
    }
    flat = true;
    while(flat && midy + 2 * s * (cu + 1) <= N){
        cout << "examine " << midx  << " " << midy + 2 * s * (cu + 1) << endl;
        string ans;
        cin >> ans;
        if(ans != "true"){
            flat = false;
        }
        else{
            cu++ ;
        }
    }
    flat = true;
    while(flat && midy - 2 * s * (cd + 1) >= 1){
        cout << "examine " << midx  << " " << midy - 2 * s * (cd + 1) << endl;
        string ans;
        cin >> ans;
        if(ans != "true"){
            flat = false;
        }
        else{
            cd++;
        }
    }
    if(cl + cr == 2){
        cout << "solution ";
        if(cl == cr){
            cout << midx << " ";
        }
        if(cl == 0){
            cout << midx + s * 2  << " ";
        }
        if(cl == 2){
            cout << midx - s * 2 << " ";
        }
        if(cu == cd){
            cout << midy << " ";
        }
        if(cd == 0){
            cout << midy + s * 2  << " ";
        }
        if(cd == 2){
            cout << midy - s * 2 << " ";
        }
        cout << endl;
    }
    else{
        cout << "solution ";
        if(cl == 0){
            cout << midx + s << " ";
        }
        if(cl == 1){
            cout << midx - s << " ";
        }
        if(cd == 0){
            cout << midy + s << " ";
        }
        if(cd == 1){
            cout << midy - s << " ";
        }
        cout << endl;
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB Incorrect
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -