Submission #792833

#TimeUsernameProblemLanguageResultExecution timeMemory
792833WarinchaiAliens (IOI07_aliens)C++14
0 / 100
2 ms256 KiB
#include<bits/stdc++.h> using namespace std; int main(){ long long n,x,y; cin>>n>>x>>y; long long lm=1,rm=1; while(lm+x<=n){ cout<<"examine "<<lm+x<<" "<<y<<endl; string hv; cin>>hv; if(hv=="false"){ break; } lm=lm*2; } //cout<<"lm:"<<lm<<endl; long long en=lm+x; long long st=x+(lm/2); long long ansr=0; if(lm+x>n){ en=n; } while(st<=en){ long long m=(st+en)/2; cout<<"examine "<<m<<" "<<y<<endl; string hv; cin>>hv; if(hv=="true"){ ansr=m; st=m+1; }else{ en=m-1; } } //cout<<"ansr:"<<ansr<<endl; //end while(x-rm>=1){ cout<<"examine "<<x-rm<<" "<<y<<endl; string hv; cin>>hv; if(hv=="false"){ break; } rm=rm*2; } //cout<<"rm:"<<rm<<endl; st=x-rm; en=x-(rm/2); long long ansl=0; if(x-rm<1){ st=1; } while(st<=en){ long long m=(st+en)/2; cout<<"examine "<<m<<" "<<y<<endl; string hv; cin>>hv; if(hv=="true"){ ansl=m; en=m-1; }else{ st=m+1; } } //cout<<"ansl:"<<ansl<<endl; long long sz=(ansr-ansl+1); //cout<<"sz:"<<sz<<endl; long long stx,sty; st=0,en=sz; while(st<=en){ long long m=(st+en)/2; if(ansl-m*sz<1){ en=m-1; continue; } long long sq=ansl-m*sz; cout<<"examine "<<sq<<" "<<y<<endl; string hv; cin>>hv; if(hv=="true"){ stx=sq; st=m+1; }else{ en=m-1; } } //cout<<"starting of x"<<stx<<endl; st=y-sz,en=y; if(st<1){ st=1; } long long ansu; while(st<=en){ long long m=(st+en)/2; cout<<"examine "<<x<<" "<<m<<endl; string hv; cin>>hv; if(hv=="true"){ ansu=m; en=m-1; }else{ st=m+1; } } //cout<<"start of little square y:"<<ansu<<endl; st=0,en=sz; while(st<=en){ long long m=(st+en)/2; if(ansu-m*sz<1){ en=m-1; continue; } long long sq=ansu-m*sz; cout<<"examine "<<x<<" "<<sq<<endl; string hv; cin>>hv; if(hv=="true"){ sty=sq; st=m+1; }else{ en=m-1; } } //cout<<"start of y:"<<sty<<endl; long long add; add=(sz)/2; add=add*sz*2; add+=sz/2; //long long runtimeerror=1/0; //cout<<"solution "<<runtimeerror<<" "<<runtimeerror<<endl; cout<<"solution "<<stx+add<<" "<<sty+add; }

Compilation message (stderr)

aliens.cpp: In function 'int main()':
aliens.cpp:131:28: warning: 'stx' may be used uninitialized in this function [-Wmaybe-uninitialized]
  131 |     cout<<"solution "<<stx+add<<" "<<sty+add;
      |                            ^~~
aliens.cpp:131:42: warning: 'sty' may be used uninitialized in this function [-Wmaybe-uninitialized]
  131 |     cout<<"solution "<<stx+add<<" "<<sty+add;
      |                                          ^~~
aliens.cpp:109:16: warning: 'ansu' may be used uninitialized in this function [-Wmaybe-uninitialized]
  109 |         if(ansu-m*sz<1){
      |            ~~~~^~~~~
#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...