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;
using ll = long long;
#define rep(a) for(ll i = 0; i < a; i++)
#define all(a) begin(a), end(a)
#define sum(a) accumulate(all(a), 0LL)
ll n;
bool query(ll x, ll y){
if(x < 1 || y < 1 || x > n || y > n) return false;
cout << "examine " << x << ' ' << y << endl;
string ans;
cin >> ans;
return ans[0] == 't';
}
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
ll x, y;
cin >> n >> x >> y;
ll ng = 0, ok = 1;
while(query(x - ok, y)){
ng = ok;
ok *= 2;
}
while(ok - ng > 1){
ll cen = (ok + ng) / 2;
if(query(x - cen, y)) ng = cen;
else ok = cen;
}
x -= ng;
ng = 0; ok = 1;
while(query(x, y - ok)){
ng = ok;
ok *= 2;
}
while(ok - ng > 1){
ll cen = (ok + ng) / 2;
if(query(x, y - cen)) ng = cen;
else ok = cen;
}
y -= ng;
ng = 0; ok = 1;
while(query(x + ok, y)){
ng = ok;
ok *= 2;
}
while(ok - ng > 1){
ll cen = (ok + ng) / 2;
if(query(x + cen, y)) ng = cen;
else ok = cen;
}
ll m = ok;
x += m / 2;
y += m / 2;
if(query(x - m * 2, y)) x -= m * 2;
if(query(x - m * 2, y)) x -= m * 2;
if(query(x, y - m * 2)) y -= m * 2;
if(query(x, y - m * 2)) y -= m * 2;
if(query(x - m, y - m)){
x -= m;
y -= m;
}
x += m * 2;
y += m * 2;
cout << "solution " << x << ' ' << y << endl;
}
# | 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... |