# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
54295 |
2018-07-03T06:12:17 Z |
노영훈(#1472) |
Aliens (IOI07_aliens) |
C++11 |
|
3 ms |
640 KB |
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MX=500010, inf=2e9;
int n, x0, y0, m;
bool ask(int x, int y){
if(x<1 || n<x || y<1 || n<y) return false;
cout<<"examine "<<x<<' '<<y<<endl;
char S[10]; cin>>S;
return S[0]=='t';
}
int find1(int x, int y, int dx){
ll pw=1;
while(ask(x+dx*pw, y)) pw*=2;
if(pw==1) return x;
// [x+pw/2 ~ x+pw)
int s=pw/2, e=pw-1;
while(s<e){
int m=(s+e+1)/2;
if(ask(x+m*dx, y)) s=m;
else e=m-1;
}
return x+s*dx;
}
int find2(int x, int y, int dy){
int s=0, e=m;
while(s<e){
int m=(s+e+1)/2;
if(ask(x,y+m*dy)) s=m;
else e=m-1;
}
return y+s*dy;
}
void solve(int &x, int &y){
bool A[4], B[4];
// A
// 1
// 2 0
// 3
// B
// 1 0
//
// 2 3
A[0]=ask(x+2*m, y);
A[1]=ask(x, y+2*m);
A[2]=ask(x-2*m, y);
A[3]=ask(x, y-2*m);
B[0]=ask(x+m,y+m);
B[1]=ask(x-m,y+m);
B[2]=ask(x-m,y-m);
B[3]=ask(x+m,y-m);
if(B[0]&&B[1]&&B[2]&&B[3]){
if(!A[0]) x-=m;
if(!A[1]) y-=m;
if(!A[2]) x+=m;
if(!A[3]) y+=m;
}
else{
if(!A[0]) x-=2*m;
if(!A[1]) y-=2*m;
if(!A[2]) x+=2*m;
if(!A[3]) y+=2*m;
}
}
int main(){
ios::sync_with_stdio(0); cin.tie(0);
cin>>n>>x0>>y0;
int a=find1(x0, y0, 1), b=find1(x0, y0, -1);
cout<<a<<' '<<b<<endl;
m=a-b+1;
x0=(a+b)/2;
int c=find2(x0, y0, 1), d=find2(x0, y0, -1);
y0=(c+d)/2;
solve(x0, y0);
cout<<"solution "<<x0<<' '<<y0<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
Expected integer, but "examine" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
308 KB |
Expected integer, but "examine" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
512 KB |
Expected integer, but "examine" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
512 KB |
Expected integer, but "examine" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
512 KB |
Expected integer, but "examine" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
640 KB |
Expected integer, but "examine" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
640 KB |
Expected integer, but "examine" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
640 KB |
Expected integer, but "examine" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
640 KB |
Expected integer, but "examine" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
640 KB |
Expected integer, but "examine" found |
2 |
Halted |
0 ms |
0 KB |
- |