#include <bits/stdc++.h>
using namespace std;
long long n;
bool ask(long long x, long long y) {
if (x <= 0 || x > n || y <= 0 || y > n) {
return false;
}
cout << "examine " << x << " " << y << endl;
string s;
cin >> s;
return (s == "true");
}
int main() {
long long x, y;
cin >> n >> x >> y;
long long top = 0, right = 0, down = 0, left = 0;
int mn = 32;
for (int i = 0; i < mn; i++) {
if (ask(x, y + (1LL << i)) == false) {
long long curY = y;
for (int j = i - 1; j >= 0; j--) {
if (ask(x, curY + (1LL << j)) == true) {
curY += (1LL << j);
}
}
top = curY - y;
break;
}
}
for (int i = 0; i < mn; i++) {
if (ask(x, y - (1LL << i)) == false) {
long long curY = y;
for (int j = i - 1; j >= 0; j--) {
if (ask(x, curY - (1LL << j)) == true) {
curY -= (1LL << j);
}
}
down = y - curY;
break;
}
}
for (int i = 0; i < mn; i++) {
if (ask(x + (1LL << i), y) == false) {
long long curX = x;
for (int j = i - 1; j >= 0; j--) {
if (ask(curX + (1LL << j), y) == true) {
curX += (1LL << j);
}
}
right = curX - x;
break;
}
}
for (int i = 0; i < mn; i++) {
if (ask(x - (1LL << i), y) == false) {
long long curX = x;
for (int j = i - 1; j >= 0; j--) {
if (ask(curX - (1LL << j), y) == true) {
curX -= (1LL << j);
}
}
left = x - curX;
break;
}
}
long long m = left + right + 1;
for (int i = -2; i <= 2; i++) {
for (int j = -2; j <= 2; j++) {
long long curX = x + (long long) i * m;
long long curY = y + (long long) j * m;
if ((i + 2) % 2 == (j + 2) % 2) {
if (ask(curX, curY) == true && ask(curX + 2 * m, curY) == true && ask(curX, curY + 2 * m) == true && ask(curX - 2 * m, curY) == true && ask(curX, curY - 2 * m) == true) {
cout << "solution " << curX + (right - left) / 2 << " " << curY + (top - down) / 2 << endl;
return 0;
}
}
}
}
return 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... |