Submission #597121

#TimeUsernameProblemLanguageResultExecution timeMemory
597121ttamxAliens (IOI07_aliens)C++14
0 / 100
3 ms208 KiB
#include<bits/stdc++.h>

using namespace std;

int n,xo,yo;

bool check(int x,int y){
    cout << "examine " << x << " " << y << endl;
    string ret;
    cin >> ret;
    return ret=="true";
}

int main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    cin >> n >> xo >> yo;
    int l=xo,r=n;
    for(int i=1;xo+i<=n;i<<=1){
        if(!check(xo+i,yo)){
            r=xo+i;
            break;
        }else{
            l=xo+i;
        }
    }
    while(r-1>l){
        int m=(l+r)>>1;
        if(check(m,yo)){
            l=m;
        }else{
            r=m;
        }
    }
    int xr=l;
    l=1,r=xo;
    for(int i=1;xo-i>=1;i<<=1){
        if(!check(xo-i,yo)){
            l=xo-i;
            break;
        }else{
            r=xo-i;
        }
    }
    while(r-1>l){
        int m=(l+r)>>1;
        if(check(m,yo)){
            r=m;
        }else{
            l=m;
        }
    }
    int xl=r;
    int sz=xr-xl+1;
    l=1,r=xl;
    for(int i=2*sz;xl-i>=1;i<<=1){
        if(!check(xl-i,yo)){
            l=xl-i;
            break;
        }else{
            r=xl-i;
        }
    }
    while(r-sz>l){
        int m=(l+r)>>1;
        if(check(m,yo)){
            r=m;
        }else{
            l=m;
        }
    }
    int Xl=r;
    l=yo,r=n;
    for(int i=2*sz;yo+i<=n;i<<=1){
        if(!check(Xl,yo+i)){
            r=yo+i;
            break;
        }else{
            l=yo+i;
        }
    }
    while(r-sz>l){
        int m=(l+r)>>1;
        if(check(Xl,m)){
            l=m;
        }else{
            r=m;
        }
    }
    while(r-1>l){
        int m=(l+r)>>1;
        if(check(Xl,m)){
            l=m;
        }else{
            r=m;
        }
    }
    int Yr=l;
    sz=(sz*5)/2;
    cout << "solution " << Xl+sz << " " << Yr-sz << 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...