//GRT_2018
#include <bits/stdc++.h>
#define PB push_back
#define ST first
#define ND second
//mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
using namespace std;
#define int long long
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
bool ask(int x, int y) {
cout << "examine " << x << " " << y << endl;
string s;
cin >> s;
return s == "true";
}
int n, x_0, y_0;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> x_0 >> y_0;
{
int bad = -1;
for(int i = 0; ; ++i) {
int y = min(n, y_0 + (1 << i));
if(!ask(x_0, y)) {
bad = y;
break;
} else if(y == n) {
break;
}
y_0 = y;
}
if(bad == -1) {
y_0 = n;
} else {
int low = y_0, high = bad, mid;
while(low <= high) {
mid = (low + high) >> 1;
if(ask(x_0, mid)) {
low = mid + 1;
} else {
high = mid - 1;
}
}
y_0 = low - 1;
}
}
{
int bad = -1;
for(int i = 0; ; ++i) {
int x = min(n, x_0 + (1 << i));
if(!ask(x, y_0)) {
bad = x;
break;
} else if(x == n) {
break;
}
x_0 = x;
}
if(bad == -1) {
x_0 = n;
} else {
int low = x_0, high = bad, mid;
while(low <= high) {
mid = (low + high) >> 1;
if(ask(mid, y_0)) {
low = mid + 1;
} else {
high = mid - 1;
}
}
x_0 = low - 1;
}
}
int m = -1;
{
int bad = -1;
int pos = x_0;
for(int i = 0; ; ++i) {
int x = max(1LL, pos - (1<< i));
if(!ask(x, y_0)) {
bad = x;
break;
} else if(x == 1) {
break;
}
pos = x;
}
int low = bad, high = pos, mid;
while(low <= high) {
mid = (low + high) >> 1;
if(ask(mid, y_0)) {
high = mid - 1;
} else {
low = mid + 1;
}
}
m = x_0 - (high + 1) + 1;
}
while((x_0 - m) >= 1 && (y_0 - m) >= 1 && ask(x_0 - m, y_0 - m)) {
x_0 -= m;
y_0 -= m;
}
while((x_0 - 2*m) >= 1 && ask(x_0 - 2 * m, y_0)) {
x_0 -= 2 * m;
}
while((y_0 - 2 * m) >= 1 && ask(x_0, y_0 - 2 * m)) {
y_0 -= 2 * m;
}
x_0 -= (m - 1);
y_0 -= (m - 1);
cout << "solution " << x_0 + 2 * m + m/2 << " " << y_0 + 2 * m + m/2;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Correct |
3 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
2 ms |
208 KB |
Output is correct |
3 |
Correct |
2 ms |
208 KB |
Output is correct |