#include <bits/stdc++.h>
using namespace std;
#define int long long
int n;
bool ask(int x, int y) {
if (x <= 0 || x > n || y <= 0 || y > n)
return false;
cout << "examine " << x << " " << y << endl;
string s;
cin >> s;
return s == "true";
}
signed main() {
int x, y;
cin >> n >> x >> y;
int top, right, down, left;
const int mn = 32;
for (int i = 0; i < mn; i++) {
if (!ask(x, y + (1 << i))) {
int cury = y;
for (int j = i - 1; j >= 0; j--) {
if (ask(x, cury + (1 << j))) {
cury += (1 << j);
}
}
top = cury - y;
break;
}
}
for (int i = 0; i < mn; i++) {
if (!ask(x, y - (1 << i))) {
int cury = y;
for (int j = i - 1; j >= 0; j--) {
if (ask(x, cury - (1 << j))) {
cury -= (1 << j);
}
}
down = y - cury;
break;
}
}
for (int i = 0; i < mn; i++) {
if (!ask(x + (1 << i), y)) {
int curx = x;
for (int j = i - 1; j >= 0; j--) {
if (ask(curx + (1 << j), y)) {
curx += (1 << j);
}
}
right = curx - x;
break;
}
}
for (int i = 0; i < mn; i++) {
if (!ask(x - (1 << i), y)) {
int curx = x;
for (int j = i - 1; j >= 0; j--) {
if (ask(curx - (1 << j), y)) {
curx -= (1 << j);
}
}
left = x - curx;
break;
}
}
int m = left + right + 1;
assert(m % 2 == 1);
for (int i = -4; i <= 4; i += 2)
for (int j = -4; j <= 4; j += 2) {
int curx = x + i * m, cury = y + i * m;
if (!ask(curx, cury))
continue;
if (ask(curx + 2 * m, cury) && ask(curx, cury + 2 * m) &&
ask(curx - 2 * m, cury) && ask(curx, cury - 2 * m)) {
cout << "solution " << (right - left) / 2 + curx << " "
<< (top - down) / 2 + cury << endl;
return 0;
}
}
assert(0);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |