Submission #1010906

#TimeUsernameProblemLanguageResultExecution timeMemory
1010906ivazivaAliens (IOI07_aliens)C++14
0 / 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;cin>>rez; if (rez=="true") eksponentdesno=st2[i]; else break; } long long ldesno=eksponentdesno; long long rdesno=min(2*eksponentdesno,n-x0); long long rezdesno=x0; while (ldesno<=rdesno) { long long mid=(ldesno+rdesno)/2; cout<<"examine "<<x0+mid<<" "<<y0<<endl;cin>>rez; if (rez=="true") {rezdesno=mid;ldesno=mid+1;} else rdesno=mid-1; } long long desno=x0+rezdesno; 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;cin>>rez; if (rez=="true") eksponentlevo=st2[i]; else break; } long long llevo=eksponentlevo; long long rlevo=min(eksponentlevo*2,x0); long long rezlevo=y0; while (llevo<=rlevo) { long long mid=(llevo+rlevo)/2; cout<<"examine "<<x0-mid<<" "<<y0<<endl;cin>>rez; if (rez=="true") {rezlevo=mid;llevo=mid+1;} else rlevo=mid-1; } long long levo=x0-rezlevo; long long m=desno-levo+1; long long lgore=0,rgore=min(m,y0-1); long long rezgore=0; while (lgore<=rgore) { long long mid=(lgore+rgore)/2; cout<<"examine "<<x0<<" "<<y0-mid<<endl;cin>>rez; if (rez=="true") {rezgore=mid;lgore=mid+1;} else rgore=mid-1; } long long gore=y0-rezgore; long long dole=gore+m-1; long long centarx=(levo+desno)/2; long long centary=(gore+dole)/2; long long lpomeraj=0,rpomeraj; if (centarx%m==0) rpomeraj=(centarx/m)-1; else rpomeraj=centarx/m; if (centary%m==0) rpomeraj=min(rpomeraj,(centary/m)-1); else rpomeraj=min(rpomeraj,centary/m); long long rezpomeraj=0; while (lpomeraj<=rpomeraj) { long long mid=(lpomeraj+rpomeraj)/2; cout<<"examine "<<centarx-mid*m<<" "<<centary-mid*m<<endl;cin>>rez; if (rez=="true") {rezpomeraj=mid;lpomeraj=mid+1;} else rpomeraj=mid-1; } long long pozx=centarx+(2-rezpomeraj)*m; long long pozy=centary+(2-rezpomeraj)*m; cout<<"solution "<<pozx<<" "<<pozy<<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...