#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vll vector<pll>
#define vii vector<pii>
using namespace std;
ll n, x, y, m, midx, midy, hor, ver, jump;
void h3(int bright, int bleft){
int bup = 0, bdown = 0;
while(true){
if(midy + (bup + 1) * jump > n)
break;
string response;
cout<<"examine "<<midx<<" "<<midy + (bup + 1) * jump<<endl;
cin>>response;
if(response[0] == 't')
bup++;
else
break;
}
while(true){
if(midy - (bdown + 1) * jump < 1)
break;
string response;
cout<<"examine "<<midx<<" "<<midy - (bdown + 1) * jump<<endl;
cin>>response;
if(response[0] == 't')
bdown++;
else
break;
}
if(bright == bleft){
if(bup == bdown)
cout<<"solution "<<midx<<" "<<midy<<endl;
else if(bup == 2)
cout<<"solution "<<midx<<" "<<midy - jump<<endl;
else
cout<<"solution "<<midx<<" "<<midy + jump<<endl;
}
else if(bright == 2){
if(bup == bdown)
cout<<"solution "<<midx + jump<<" "<<midy<<endl;
else if(bup == 2)
cout<<"solution "<<midx + jump<<" "<<midy - jump<<endl;
else
cout<<"solution "<<midx + jump<<" "<<midy + jump<<endl;
}
else{
if(bup == bdown)
cout<<"solution "<<midx - jump<<" "<<midy<<endl;
else if(bup == 2)
cout<<"solution "<<midx - jump<<" "<<midy - jump<<endl;
else
cout<<"solution "<<midx - jump<<" "<<midy + jump<<endl;
}
}
void h2(int bright, int bleft){
midx -= (hor - 1);
midy += (ver - 1);
h3(bright, bleft);
}
int main(){
cin>>n>>x>>y;
ll left = 0, right = 0, up = 0, down = 0;
while(true){
if(x + left + 1 > n)
break;
string response;
cout<<"examine "<<x + left + 1<<" "<<y<<endl;
cin>>response;
if(response[0] =='t')
right++;
else
break;
}
while(true){
if(x - (left + 1) < 1)
break;
string response;
cout<<"examine "<<x - left - 1<<" "<<y<<endl;
cin>>response;
if(response[0]=='t')
left++;
else
break;
}
while(true){
if(y + up + 1 > n)
break;
string response;
cout<<"examine "<<x<<" "<<y + up + 1<<endl;
cin>>response;
if(response[0]=='t')
up++;
else
break;
}
while(true){
if(y - down - 1 < 1)
break;
string response;
cout<<"examine "<<x<<" "<<y - down - 1<<endl;
cin>>response;
if(response[0] == 't')
down++;
else
break;
}
hor = left + right + 1, ver = up + down + 1;
m = hor * ver;
ll x1 = x - down, y1 = y - left;
midx = x1 + hor / 2;
midy = y1 + ver / 2;
int bleft = 0, bright = 0;
jump = hor + hor - 1;
while(true){
if(x1 + (bright + 1) * jump > n)
break;
string response;
cout<<"examine "<<x1 + bright * jump + jump<<" "<<y1<<endl;
cin>>response;
if(response[0] == 't')
bright++;
else
break;
}
while(true){
if(x1 - (bleft + 1) * jump < 1)
break;
string response;
cout<<"examine "<<x1 - bleft * jump - jump<<" "<<y1<<endl;
cin>>response;
if(response[0] =='t')
bleft++;
else
break;
}
if(bleft + bright == 2)
h3(bright, bleft);
else
h2(bright, bleft);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
288 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
384 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
432 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
384 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
384 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
384 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
384 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
256 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
256 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
384 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |