#include <bits/stdc++.h>
using namespace std;
bool examine(long long l, long long c, int n) {
string str;
if(l < 1 || l > n || c < 1 || c > n)
return false;
cout << "examine " << l << ' ' << c << endl;
cin >> str;
return str == "true";
}
pair<long long, long long> getNextWhite(long long l, long long c, int dl, int dc, int n) {
int lg = 0;
while(examine(l + dl * (1LL << lg), c + dc * (1LL << lg), n))
++lg;
long long l2 = l + dl * (1 << lg), c2 = c + dc * (1 << lg);
while(llabs(c2 - c) > 1 || llabs(l2 - l) > 1) {
long long midl, midc;
midl = (l + l2) / 2;
midc = (c + c2) / 2;
if(examine(midl, midc, n)) {
l = midl;
c = midc;
} else {
l2 = midl;
c2 = midc;
}
}
return make_pair(l2, c2);
}
int main() {
int n, m;
long long x, y;
long long maxx, maxy, minx, miny;
pair<long long, long long> lW, rW, dW;
cin >> n >> x >> y;
lW = getNextWhite(x, y, 0, -1, n);
rW = getNextWhite(x, y, 0, 1, n);
dW = getNextWhite(x, y, 1, 0, n);
m = rW.second - lW.second - 1;
x = (lW.second + rW.second) / 2;
y = (dW.first - m / 2 - 1);
maxx = maxy = -(1LL << 60);
minx = miny = 1LL << 60;
for(int i = -4; i <= 4; ++i)
for(int j = -4; j <= 4; ++j)
if(examine(x + i * m, y + j * m, n)) {
maxx = max(maxx, x + i * m);
maxy = max(maxy, y + j * m);
minx = min(minx, x + i * m);
miny = min(miny, y + j * m);
}
cout << "solution " << (minx + maxx) / 2 << ' ' << (miny + maxy) / 2 << endl;
return 0;
}
/*
1 1 1 1 1 1 1 1 1 1
1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
1
2 X X X X X X X X X
3 X X X X X X X X X
4 X X X X X X X X X
5 X X X X X X
6 X X X X X X
7 X X X X X X
8 X X X X X X X X X
9 X X X X X X X X X
10 X X X X X X X X X
11 X X X X X X
12 X X X X X X
13 X X X X X X
14 X X X X X X X X X
15 X X X X X X X X X
16 X X X X X X X X X
17
18
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Expected integer, but "solution" found |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Expected integer, but "solution" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Expected integer, but "solution" found |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Expected integer, but "examine" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Expected integer, but "examine" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
440 KB |
Expected integer, but "examine" found |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Expected integer, but "examine" found |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
444 KB |
Expected integer, but "examine" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Expected integer, but "examine" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
Expected integer, but "examine" found |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Expected integer, but "solution" found |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Expected integer, but "solution" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Expected integer, but "examine" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
Expected integer, but "examine" found |
2 |
Halted |
0 ms |
0 KB |
- |