#include <bits/stdc++.h>
#define fr first
#define sc second
#define pii pair<int, int>
#define pb push_back
#define szof(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define int long long
template<class T>void chmax(T &a, T b){if (a < b)a = b;}
template<class T>void chmin(T &a, T b){if (b < a)a = b;}
using namespace std;
const int KEK = -1337;
int n, x, y;
int pw(int x) {
return (1ll << x);
}
bool in(int pos) {
return pos >= 1 && pos <= n;
}
bool ask(int x, int y) {
if (in(x) && in(y)) {
cout << "examine " << x << " " << y << endl;
string res;
return res == "true";
} else {
return false;
}
}
signed main() {
cin >> n >> x >> y;
int X = x, Y = y;
int max_x, max_y;
for (int i = 2; ; i *= 2) {
if (!ask(x, y + i)) {
for (int j = i / 2; j > 0; j /= 2) {
if (ask(x, y + j)) {
y += j;
}
}
max_y = y;
y = Y;
break;
}
}
for (int i = 2; ; i *= 2) {
if (!ask(x + i, y)) {
for (int j = i / 2; j > 0; j /= 2) {
if (ask(x + j, y)) {
x += j;
}
max_x = x;
x = X;
}
break;
}
}
int curx = max_x, cury = max_y;
int min_y;
for (int i = 2; ; i *= 2) {
if (!ask(curx, cury - i)) {
int cc = cury;
for (int j = i / 2; j > 0; j /= 2) {
if (ask(curx, cc - j)) {
cc -= j;
}
}
min_y = cc;
break;
}
}
int len = max_y - min_y + 1;
int cur_x = max_x;
int cur_y = max_y;
while (ask(cur_x + len, cur_y + len)) {
cur_x += len;
cur_y += len;
}
while (ask(cur_x, cur_y + len * 2)) {
cur_y += len * 2;
}
while (ask(cur_x + len * 2, cur_y)) {
curx += len * 2;
}
cout << "solution " << cur_x - len * 2 - len / 2 << " " << cur_y - len * 2 - len / 2 << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |