# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1100041 |
2024-10-12T15:04:10 Z |
adkjt |
Aliens (IOI07_aliens) |
C++14 |
|
2 ms |
344 KB |
#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<<' '<<yn<<'\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
aliens.cpp: In function 'int main()':
aliens.cpp:84:39: warning: 'yn' may be used uninitialized in this function [-Wmaybe-uninitialized]
84 | cout<<"examine "<<x<<' '<<yn<<'\n';
| ^~~~
aliens.cpp:43:19: warning: 'xn' may be used uninitialized in this function [-Wmaybe-uninitialized]
43 | int xm=(xl+xr)/2;
| ~~~^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Unexpected end of file - token expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
344 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
344 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
344 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
344 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
344 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
344 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
344 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |