#include <bits/stdc++.h>
using namespace std;
#define int long long
const int dx[4] = {1, -1, -1, 1}, dy[4] = {-1, -1, 1, 1};
int n, X_[2], Y_[2];
bool ask(int x, int y) {
if(x <= 0 || y <= 0 || x > n || y > n) return 0;
cout << "examine " << x << " " << y << endl;
string s; cin >> s;
return s == "true";
}
void work(int x, int y) {
// cout << x << " " << y << endl;
int x1 = 0, x2 = 0, y1 = 0, y2 = 0;
{
int l = 0, r = n;
while(l <= r) {
int mid = (l + r) / 2;
if(ask(x, y + 2 * mid)) {
l = mid + 1, y2 = mid;
} else {
r = mid - 1;
}
}
}
{
int l = 0, r = n;
while(l <= r) {
int mid = (l + r) / 2;
if(ask(x, y - 2 * mid)) {
l = mid + 1, y1 = mid;
} else {
r = mid - 1;
}
}
}
{
int l = 0, r = n;
while(l <= r) {
int mid = (l + r) / 2;
if(ask(x - 2 * mid, y)) {
l = mid + 1, x1 = mid;
} else {
r = mid - 1;
}
}
}
{
int l = 0, r = n;
while(l <= r) {
int mid = (l + r) / 2;
if(ask(x + 2 * mid, y)) {
l = mid + 1, x2 = mid;
} else {
r = mid - 1;
}
}
}
X_[0] = min(X_[0], x - 2 * x1);
Y_[0] = min(Y_[0], y - 2 * y1);
X_[1] = max(X_[1], x + 2 * x2);
Y_[1] = max(Y_[1], y + 2 * y2);
// cout << X_[0] << " " << Y_[0] << " " << X_[1] << " " << Y_[1] << endl;
}
signed main() {
cin.tie(0); ios_base::sync_with_stdio(0);
int x, y;
cin >> n >> x >> y;
X_[0] = 1e18, Y_[0] = 1e18;
work(x, y);
int X = 0, Y = 0;
for(int i = 0; i < 4; i++) {
if(ask(x + dx[i], y + dy[i])) {
X = x + dx[i], Y = y + dy[i];
break;
}
}
// cout << X << " " << Y << '\n';
work(X, Y);
// cout << X_[0] << " " << X_[1] << '\n';
cout << "solution " << (X_[0] + X_[1]) / 2 << " " << (Y_[0] + Y_[1]) / 2 << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
2 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Incorrect |
3 ms |
208 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Incorrect |
3 ms |
208 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
208 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
208 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Correct |
2 ms |
208 KB |
Output is correct |
3 |
Incorrect |
2 ms |
208 KB |
Incorrect |
4 |
Halted |
0 ms |
0 KB |
- |