Submission #1011092

#TimeUsernameProblemLanguageResultExecution timeMemory
1011092ivazivaAliens (IOI07_aliens)C++14
100 / 100
1 ms344 KiB
#include <bits/stdc++.h> using namespace std; int main() { string rez; long long st2[30];st2[0]=1; for (long long i=1;i<30;i++) st2[i]=st2[i-1]*2; long long n,x0,y0; cin>>n>>x0>>y0; long long eksponentdesno=0; for (long long i=0;i<30;i++) { if (x0+st2[i]>n) break; cout<<"examine "<<x0+st2[i]<<" "<<y0<<endl; fflush(stdout);cin>>rez; if (rez=="true") eksponentdesno=st2[i]; else break; } long long ldesno=x0+eksponentdesno; long long rdesno=min(x0+2*eksponentdesno,n); long long rezdesno=x0; while (ldesno<=rdesno) { long long mid=(ldesno+rdesno)/2; cout<<"examine "<<mid<<" "<<y0<<endl; fflush(stdout);cin>>rez; if (rez=="true") {rezdesno=mid;ldesno=mid+1;} else rdesno=mid-1; } long long eksponentlevo=0; for (long long i=0;i<30;i++) { if (x0-st2[i]<=0) break; cout<<"examine "<<x0-st2[i]<<" "<<y0<<endl; fflush(stdout);cin>>rez; if (rez=="true") eksponentlevo=st2[i]; else break; } long long llevo=max(x0-2*eksponentlevo,(long long)1); long long rlevo=x0-eksponentlevo; long long rezlevo=x0; while (llevo<=rlevo) { long long mid=(llevo+rlevo)/2; cout<<"examine "<<mid<<" "<<y0<<endl; fflush(stdout);cin>>rez; if (rez=="true") {rezlevo=mid;rlevo=mid-1;} else llevo=mid+1; } long long m=rezdesno-rezlevo+1; long long lgore=max(y0-m,(long long)1); long long rgore=y0; long long rezgore=y0; while (lgore<=rgore) { long long mid=(lgore+rgore)/2; cout<<"examine "<<x0<<" "<<mid<<endl; fflush(stdout);cin>>rez; if (rez=="true") {rezgore=mid;rgore=mid-1;} else lgore=mid+1; } long long rezdole=rezgore+m-1; long long centarx=(rezlevo+rezdesno)/2; long long centary=(rezgore+rezdole)/2; vector<pair<long long,long long>> ans; for (long long i=-4;i<=4;i++) { for (long long j=-4;j<=4;j++) { long long pozx=centarx+i*m; long long pozy=centary+j*m; if (pozx<1 or pozx>n) continue; if (pozy<1 or pozy>n) continue; cout<<"examine "<<pozx<<" "<<pozy<<endl;fflush(stdout);cin>>rez; if (rez=="true") ans.push_back({pozx,pozy}); } } sort(ans.begin(),ans.end()); cout<<"solution "<<ans[6].first<<" "<<ans[6].second<<endl;fflush(stdout); }
#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...