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;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;
const ll maxn=2e6+5;
const ll INF=1e18;
#define ok ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define endl '\n'
ll n, x, y, l, r, u, d;
string jwb;
int mx=-1;
int main() {
ok
cin >> n >> x >> y;
for(int i=0; i<=30; i++) {
ll nx=x+(1<<i);
if(nx>n || nx<1) break;
cout << "examine " << nx << " " << y << endl;
cout.flush();
cin >> jwb;
if(jwb=="true") {
mx=i;
} else break;
}
if(mx>=0) {
r=x+(1<<mx);
} else r=x;
for(int i=mx-1; i>=0; i--) {
ll nx=r+(1<<i);
if(nx>n || nx<1) continue;
cout << "examine " << nx << " " << y << endl;
cout.flush();
cin >> jwb;
if(jwb=="true") {
r+=(1<<i);
}
}
mx=-1;
for(int i=0; i<=30; i++) {
ll nx=x-(1<<i);
if(nx>n || nx<1) break;
cout << "examine " << nx << " " << y << endl;
cout.flush();
cin >> jwb;
if(jwb=="true") {
mx=i;
} else break;
}
if(mx>=0) {
l=x-(1<<mx);
} else l=x;
for(int i=mx-1; i>=0; i--) {
ll nx=l-(1<<i);
if(nx>n || nx<1) continue;
cout << "examine " << nx << " " << y << endl;
cout.flush();
cin >> jwb;
if(jwb=="true") {
l-=(1<<i);
}
}
mx=-1;
for(int i=0; i<=30; i++) {
ll nx=y+(1<<i);
if(nx>n || nx<1) break;
cout << "examine " << x << " " << nx << endl;
cout.flush();
cin >> jwb;
if(jwb=="true") {
mx=i;
} else break;
}
if(mx>=0) {
u=y+(1<<mx);
} else u=y;
for(int i=mx-1; i>=0; i--) {
ll nx=u+(1<<i);
if(nx>n || nx<1) continue;
cout << "examine " << x << " " << nx << endl;
cout.flush();
cin >> jwb;
if(jwb=="true") {
u+=(1<<i);
}
}
mx=-1;
for(int i=0; i<=30; i++) {
ll nx=y-(1<<i);
if(nx>n || nx<1) break;
cout << "examine " << x << " " << nx << endl;
cout.flush();
cin >> jwb;
if(jwb=="true") {
mx=i;
} else break;
}
if(mx>=0) {
d=y-(1<<mx);
} else d=y;
for(int i=mx-1; i>=0; i--) {
ll nx=d-(1<<i);
if(nx>n || nx<1) continue;
cout << "examine " << x << " " << nx << endl;
cout.flush();
cin >> jwb;
if(jwb=="true") {
d-=(1<<i);
}
}
ll midx=(l+r)/2, midy=(u+d)/2, sz=u-d+1;
l=midx; r=midx; u=midy; d=midy;
for(ll i=1; i<=2; i++) {
ll nx=midx-2LL*i*sz;
if(nx<1) break;
cout << "examine " << nx << " " << midy << endl;
cout.flush();
cin >> jwb;
if(jwb=="true") {
l=nx;
} else break;
}
for(ll i=1; i<=2; i++) {
ll nx=midx+2LL*i*sz;
if(nx>n) break;
cout << "examine " << nx << " " << midy << endl;
cout.flush();
cin >> jwb;
if(jwb=="true") {
r=nx;
} else break;
}
for(ll i=1; i<=2; i++) {
ll nx=midy-2LL*i*sz;
if(nx<1) break;
cout << "examine " << midx << " " << nx << endl;
cout.flush();
cin >> jwb;
if(jwb=="true") {
d=nx;
} else break;
}
for(ll i=1; i<=2; i++) {
ll nx=midy+2LL*i*sz;
if(nx>n) break;
cout << "examine " << midx << " " << nx << endl;
cout.flush();
cin >> jwb;
if(jwb=="true") {
u=nx;
} else break;
}
cout << "solution " << (l+r)/2 << " " << (u+d)/2 << endl;
cout.flush();
return 0;
}
# | 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... |