#include <bits/stdc++.h>
using namespace std;
#define int long long int
int n;
bool query(int x, int y) {
if (x < 1 || y < 1 || x > n || y > n) {
return 0;
}
cout << "examine " << x << " " << y << endl;
string s;
cin >> s;
if (s == "true") {
return 1;
} else {
return 0;
}
}
void solve() {
int x0, y0;
cin >> n >> x0 >> y0;
int x = x0, y = y0, lx = x0, ly = y0;
for (int i = 0; i < 3; i++) {
for (int j = 31; j >= 0; j--) {
x = lx-(1LL<<j);
y = ly;
if (query(x, y)) {
lx = x;
ly = y;
}
}
}
for (int i = 0; i < 3; i++) {
for (int j = 31; j >= 0; j--) {
x = lx;
y = ly-(1LL<<j);
if (query(x, y)) {
lx = x;
ly = y;
}
}
}
for (int j = 31; j >= 0; j--) {
x = lx-(1LL<<j);
y = ly-(1LL<<j);
if (query(x, y)) {
lx = x;
ly = y;
}
}
int m = 0;
x = lx;
y = ly;
for (int j = 31; j >= 0; j--) {
if (query(x+(1<<j), y+(1<<j))) {
m += (1<<j);
x += (1<<j);
y += (1<<j);
}
}
cout << "solution " << lx+m/2 << " " << ly+m/2 << endl;
}
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
t = 1;
while(t--) {
solve();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
# |
결과 |
실행 시간 |
메모리 |
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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |