# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1024186 |
2024-07-15T15:11:39 Z |
lucri |
Aliens (IOI07_aliens) |
C++17 |
|
2 ms |
596 KB |
#include <bits/stdc++.h>
using namespace std;
long long n,x,y,m=1,b,e;
char q[15];
int main()
{
cin>>n>>x>>y;
if(x>1)
{
cout<<"examine "<<x-m<<' '<<y<<'\n';
cout.flush();
cin>>q;
while(q[0]=='t')
{
if(x-2*m<=0)
break;
m*=2;
cout<<"examine "<<x-m<<' '<<y<<'\n';
cout.flush();
cin>>q;
}
m/=2;
}
b=m,e=min(m*2,x-1);
while(b<=e)
{
int mid=(b+e)/2;
cout<<"examine "<<x-mid<<' '<<y<<'\n';
cout.flush();
cin>>q;
if(q[0]=='t')
b=mid+1;
else
e=mid-1;
}
x=x-e;
m=1;
cout<<"examine "<<x+m<<' '<<y<<'\n';
cout.flush();
cin>>q;
while(q[0]=='t')
{
if(x+2*m>n)
break;
m*=2;
cout<<"examine "<<x+m<<' '<<y<<'\n';
cout.flush();
cin>>q;
}
m/=2;
b=m,e=min(m*2,n-x);
while(b<=e)
{
int mid=(b+e)/2;
cout<<"examine "<<x+mid<<' '<<y<<'\n';
cout.flush();
cin>>q;
if(q[0]=='t')
b=mid+1;
else
e=mid-1;
}
m=b;
b=0,e=m-1;
while(b<=e)
{
int mid=(b+e)/2;
cout<<"examine "<<x<<' '<<y-mid<<'\n';
cout.flush();
cin>>q;
if(q[0]=='t')
b=mid+1;
else
e=mid-1;
}
y-=e;
while(x>m&&y>m)
{
cout<<"examine "<<x-m<<' '<<y-m<<'\n';
cout.flush();
cin>>q;
if(q[0]=='t')
{
x-=m;
y-=m;
}
else
break;
}
while(x>m*2)
{
cout<<"examine "<<x-m*2<<' '<<y<<'\n';
cout.flush();
cin>>q;
if(q[0]=='t')
{
x-=m*2;
}
else
break;
}
while(y>m*2)
{
cout<<"examine "<<x<<' '<<y-m*2<<'\n';
cout.flush();
cin>>q;
if(q[0]=='t')
{
y-=m*2;
}
else
break;
}
cout<<"solution "<<x+2*m+m/2<<' '<<y+2*m+m/2<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
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 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Incorrect |
1 ms |
344 KB |
Incorrect |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |