Submission #1024189

#TimeUsernameProblemLanguageResultExecution timeMemory
1024189lucriAliens (IOI07_aliens)C++17
100 / 100
2 ms344 KiB
#include <bits/stdc++.h> using namespace std; long long n,x,y,m=1,b,e; char q[15]; int main() { cin>>n>>x>>y; if(x>1) { cout<<"examine "<<x-m<<' '<<y<<'\n'; cout.flush(); cin>>q; while(q[0]=='t') { m*=2; cout<<"examine "<<x-m<<' '<<y<<'\n'; cout.flush(); cin>>q; } m/=2; } b=m,e=min(m*2,x-1); while(b<=e) { int mid=(b+e)/2; cout<<"examine "<<x-mid<<' '<<y<<'\n'; cout.flush(); cin>>q; if(q[0]=='t') b=mid+1; else e=mid-1; } x=x-e; m=1; cout<<"examine "<<x+m<<' '<<y<<'\n'; cout.flush(); cin>>q; while(q[0]=='t') { m*=2; cout<<"examine "<<x+m<<' '<<y<<'\n'; cout.flush(); cin>>q; } m/=2; b=m,e=min(m*2,n-x); while(b<=e) { int mid=(b+e)/2; cout<<"examine "<<x+mid<<' '<<y<<'\n'; cout.flush(); cin>>q; if(q[0]=='t') b=mid+1; else e=mid-1; } m=b; b=0,e=m-1; while(b<=e) { int mid=(b+e)/2; cout<<"examine "<<x<<' '<<y-mid<<'\n'; cout.flush(); cin>>q; if(q[0]=='t') b=mid+1; else e=mid-1; } y-=e; while(x>m&&y>m) { cout<<"examine "<<x-m<<' '<<y-m<<'\n'; cout.flush(); cin>>q; if(q[0]=='t') { x-=m; y-=m; } else break; } while(x>m*2) { cout<<"examine "<<x-m*2<<' '<<y<<'\n'; cout.flush(); cin>>q; if(q[0]=='t') { x-=m*2; } else break; } while(y>m*2) { cout<<"examine "<<x<<' '<<y-m*2<<'\n'; cout.flush(); cin>>q; if(q[0]=='t') { y-=m*2; } else break; } cout<<"solution "<<x+2*m+m/2<<' '<<y+2*m+m/2<<'\n'; 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...