#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define sz(x) (int)(x.size())
using namespace std;
using namespace __gnu_pbds;
typedef
tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
int n, k, m;
vector<int> a;
map<pair<int, int>, bool> check;
bool query(int x, int y) {
if (check.count({x, y})) return check[{x, y}];
cout << "examine " << x << " " << y << endl;
string ans; cin >> ans;
if (ans=="true") return check[{x, y}]=true;
else return check[{x, y}]=false;
}
void solve() {
cin >> n;
int x, y; cin >> x >> y;
check[{x, y}]=true;
int tempx=x, tempy=y;
int ajout=1;
while (tempx+ajout<=n && query(tempx+ajout, y)) {
ajout*=2;
}
tempx+=ajout/2;
int l=tempx, r=min(x+ajout, n);
int rx=l;
while (l<=r) {
int mid=l+(r-l)/2;
if (query(mid, y)) {
rx=mid;
l=mid+1;
} else {
r=mid-1;
}
}
tempx=x, ajout=1;
while (tempx-ajout>0 && query(tempx-ajout, y)) {
ajout*=2;
}
tempx-=ajout/2;
l=max(x-ajout, 1LL), r=tempx;
int lx=l;
while (l<=r) {
int mid=l+(r-l)/2;
if (query(mid, y)) {
lx=mid;
r=mid-1;
} else {
l=mid+1;
}
}
m=rx-lx+1;
ajout=1;
while (tempy+ajout<=n && query(x, tempy+ajout)) {
ajout*=2;
}
tempy+=ajout/2;
l=tempy, r=min(y+ajout, n);
int ry=l;
while (l<=r) {
int mid=l+(r-l)/2;
if (query(x, mid)) {
ry=mid;
l=mid+1;
} else {
r=mid-1;
}
}
int ly=ry-m+1;
int midx=lx+m/2, midy=ly+m/2;
while (x+m<=n && y+m<=n && query(x+m, y+m)) {
x+=m, y+=m;
}
while (midx+2*m<=n && query(midx+2*m, midy)) {
midx+=2*m;
}
while (midy+2*m<=n && query(midx, midy+2*m)) {
midy+=2*m;
}
cout << "solution " << midx-2*m << " " << midy-2*m << endl;
return;
}
signed main() {
ios::sync_with_stdio(0);
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
448 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
448 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
448 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
452 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Incorrect |
1 ms |
452 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
452 KB |
Output is correct |
2 |
Incorrect |
1 ms |
704 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
708 KB |
Output is correct |
2 |
Correct |
1 ms |
456 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
448 KB |
Output is correct |
2 |
Correct |
1 ms |
704 KB |
Output is correct |
3 |
Incorrect |
1 ms |
708 KB |
Incorrect |
4 |
Halted |
0 ms |
0 KB |
- |