Submission #597137

#TimeUsernameProblemLanguageResultExecution timeMemory
597137ttamxAliens (IOI07_aliens)C++14
70 / 100
2 ms300 KiB
#include<bits/stdc++.h>
#define ll long long

using namespace std;

ll n,xo,yo;

bool check(ll x,ll 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;
    ll l=xo,r=n;
    for(ll i=1;xo+i<=n;i<<=1){
        if(!check(xo+i,yo)){
            r=xo+i;
            break;
        }else{
            l=xo+i;
        }
    }
    while(r-1>l){
        ll m=(l+r)>>1;
        if(check(m,yo)){
            l=m;
        }else{
            r=m;
        }
    }
    ll xr=l;
    l=1,r=xo;
    for(ll i=1;xo-i>=1;i<<=1){
        if(!check(xo-i,yo)){
            l=xo-i;
            break;
        }else{
            r=xo-i;
        }
    }
    while(r-1>l){
        ll m=(l+r)>>1;
        if(check(m,yo)){
            r=m;
        }else{
            l=m;
        }
    }
    ll xl=r;
    ll sz=xr-xl+1;
    l=xr,r=n;
    for(ll i=2*sz;xr+i<=n;i<<=1){
        if(!check(xr+i,yo)){
            r=xr+i;
            break;
        }else{
            l=xr+i;
        }
    }
    while(r-sz>l){
        ll m=(l+r)>>1;
        if(check(m,yo)){
            l=m;
        }else{
            r=m;
        }
    }
    ll Xr=l;
    l=1,r=xl;
    for(ll 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){
        ll m=(l+r)>>1;
        if(check(m,yo)){
            r=m;
        }else{
            l=m;
        }
    }
    ll Xl=r;
    l=yo,r=n;
    for(ll 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){
        ll m=(l+r)>>1;
        if(check(Xl,m)){
            l=m;
        }else{
            r=m;
        }
    }
    while(r-1>l){
        ll m=(l+r)>>1;
        if(check(Xl,m)){
            l=m;
        }else{
            r=m;
        }
    }
    ll Yr=l;
    sz=(Xr-Xl)/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...