This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int M = 31623;
const int N = 2'000'000'000;
bool check(int i,int j,int n){
if(i >0 && j >0 && i <= n && j <= n){
cout << "examine " << i << " " << j << endl;
string s;cin >> s;
return ((s == "true")? true : false);
}
return 0;
}
signed main(){
iostream::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
int n,x,y;cin >> n >> x >> y;
int rx = x;
for( ;rx<=n;rx++){
if(!check(rx,y,n)){
break;
}
}
rx--;
int ry = y;
for(;ry<=n;ry++)
if(!check(rx,ry,n))
break;
ry--;
int l = 0,r = n - max(rx,ry);
while(l < r){
int mid = (l + r + 1)/2;
if(check(rx + mid, ry + mid,n))
l = mid;
else
r = mid - 1;
}
pair<int,int> topcorner = {rx + l, ry + l};
l = 0,r = min(rx,ry) - 1;
while(l < r){
int mid = (l + r + 1)/2;
if(check(rx - mid,ry - mid, n))
l = mid;
else
r = mid - 1;
}
pair<int,int> bottomcorner = {rx - l,ry - l};
pair<int,int> center = {(topcorner.first + bottomcorner.first)/2,(topcorner.second + bottomcorner.second)/2};
cout << "solution " << center.first << " " << center.second << "\n";
}
# | 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... |