#include <bits/stdc++.h>
using namespace std;
int n, x, y;
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";
}
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
cin >> n >> x >> y;
long long x1, x2, y1, y2;
{
int l = 0, r = n / 2;
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 / 2;
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 / 2;
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 / 2;
while(l <= r) {
int mid = (l + r) / 2;
if(ask(x + 2 * mid, y)) {
l = mid + 1, x2 = mid;
} else {
r = mid - 1;
}
}
}
x1 = x - 2 * x1;
x2 = x + 2 * x2;
y1 = y - 2 * y1;
y2 = y + 2 * y2;
cout << "solution " << (x1 + x2) / 2 << " " << (y1 + y2) / 2 << endl;
}
Compilation message
aliens.cpp: In function 'int main()':
aliens.cpp:66:13: warning: 'y2' may be used uninitialized in this function [-Wmaybe-uninitialized]
66 | y2 = y + 2 * y2;
| ~~^~~~
aliens.cpp:65:13: warning: 'y1' may be used uninitialized in this function [-Wmaybe-uninitialized]
65 | y1 = y - 2 * y1;
| ~~^~~~
aliens.cpp:63:13: warning: 'x1' may be used uninitialized in this function [-Wmaybe-uninitialized]
63 | x1 = x - 2 * x1;
| ~~^~~~
aliens.cpp:64:13: warning: 'x2' may be used uninitialized in this function [-Wmaybe-uninitialized]
64 | x2 = x + 2 * x2;
| ~~^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 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 |
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 |
Incorrect |
1 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 |
Incorrect |
2 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 |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
208 KB |
Incorrect |
4 |
Halted |
0 ms |
0 KB |
- |