Submission #1100043

#TimeUsernameProblemLanguageResultExecution timeMemory
1100043adkjtAliens (IOI07_aliens)C++14
0 / 100
3 ms344 KiB
#include<bits/stdc++.h> using namespace std; string ans; int main() { int n,x,y;cin>>n>>x>>y; int xl,xr,yl,yr; //Find size int xn,yn,p; int X1,X2,Y1,Y2; //Right p=-1; while(ans!="true") { p++; xn=x+(1<<p); cout<<"examine "<<xn<<' '<<y<<'\n'; cin>>ans; } xl=x,xr=xn; while(xl<xr) { int xm=(xl+xr)/2; cout<<"examine "<<xm<<' '<<y<<'\n'; cin>>ans; if(ans=="false") xr=xm; else xl=xm+1; } X1=xl; //Left ans="false"; p=-1; while(ans!="true") { p++; xn=x-(1<<p); cout<<"examine "<<xn<<' '<<y<<'\n'; cin>>ans; } xl=xn,xr=x; while(xl<xr) { int xm=(xl+xr)/2; cout<<"examine "<<xm<<' '<<y<<'\n'; cin>>ans; if(ans=="false") xr=xm; else xl=xm+1; } X2=xl; //Up ans="false"; p=-1; while(ans!="true") { p++; yn=y-(1<<p); cout<<"examine "<<x<<' '<<yn<<'\n'; cin>>ans; } yl=yn,yr=y; while(yl<yr) { int ym=(yl+yr)/2; cout<<"examine "<<x<<' '<<ym<<'\n'; cin>>ans; if(ans=="false") yr=ym; else yl=ym+1; } Y1=yl; //Down ans="false"; p=-1; while(ans!="true") { p++; yn=y-(1<<p); cout<<"examine "<<n<<' '<<yn<<'\n'; cin>>ans; } yl=yn,yr=y; while(yl<yr) { int ym=(yl+yr)/2; cout<<"examine "<<x<<' '<<ym<<'\n'; cin>>ans; if(ans=="false") yr=ym; else yl=ym+1; } Y2=yl; int sz=abs(X1-X2); //Find box cen x=(X1+X2)/2; y=(Y1+Y2)/2; string L,R,U,D; cout<<"examine "<<x+2*sz<<' '<<y<<'\n'; cin>>R; cout<<"examine "<<x-2*sz<<' '<<y<<'\n'; cin>>L; cout<<"examine "<<x<<' '<<y+2*sz<<'\n'; cin>>U; cout<<"examine "<<x<<' '<<y-2*sz<<'\n'; cin>>D; if(L=="true"&&R=="true"&&U=="true"&&D=="true") cout<<"solution "<<x<<' '<<y; else if(L=="true"&&R=="true"&&U=="true"&&D!="true") cout<<"solution "<<x<<' '<<y+2*sz; else if(L=="true"&&R=="true"&&U!="true"&&D=="true") cout<<"solution "<<x<<' '<<y-2*sz; else if(L=="true"&&R!="true"&&U=="true"&&D=="true") cout<<"solution "<<x-2*sz<<' '<<y; else if(L!="true"&&R=="true"&&U=="true"&&D=="true") cout<<"solution "<<x+2*sz<<' '<<y; else if(L!="true"&&R=="true"&&U=="true"&&D!="true") cout<<"solution "<<x+2*sz<<' '<<y+2*sz; else if(L=="true"&&R!="true"&&U=="true"&&D!="true") cout<<"solution "<<x-2*sz<<' '<<y+2*sz; else if(L=="true"&&R!="true"&&U!="true"&&D=="true") cout<<"solution "<<x-2*sz<<' '<<y-2*sz; else if(L!="true"&&R=="true"&&U!="true"&&D=="true") cout<<"solution "<<x+2*sz<<' '<<y-2*sz; }

Compilation message (stderr)

aliens.cpp: In function 'int main()':
aliens.cpp:83:19: warning: 'yn' may be used uninitialized in this function [-Wmaybe-uninitialized]
   83 |         int ym=(yl+yr)/2;
      |                ~~~^~~~
aliens.cpp:43:19: warning: 'xn' may be used uninitialized in this function [-Wmaybe-uninitialized]
   43 |         int xm=(xl+xr)/2;
      |                ~~~^~~~
#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...