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;
int n, x, y, m, bl, br, xl, xr, yl, yr;
string s;
int pow2[50];
signed main() {
cin >> n >> x >> y;
pow2[0] = 1;
for(int i=1; i<50; i++) {
pow2[i] = pow2[i-1] * 2;
}
for(int i=0; i<n; i++) {
bl = i == 0 ? x : x + pow2[i-1];
br = x + pow2[i];
cout << "examine " << br << " " << y << endl;
cin >> s;
if(s[0] == 'f') break;
}
while(bl < br) {
int mid = bl + (br-bl)/2;
cout << "examine " << mid << " " << y << endl;
cin >> s;
if(s[0] == 't') {
bl = mid+1;
} else {
br = mid;
}
}
xr = bl-1;
for(int i=0; i<n; i++) {
bl = i == 0 ? x : x - pow2[i-1];
br = x - pow2[i];
cout << "examine " << x-pow2[i] << " " << y << endl;
cin >> s;
if(s[0] == 'f') break;
}
while(bl < br) {
int mid = bl + (br-bl)/2;
cout << "examine " << x-mid << " " << y << endl;
cin >> s;
if(s[0] == 't') {
bl = mid+1;
} else {
br = mid;
}
}
xl = bl;
m = xr-xl+1;
bl = 0, br = m;
while(bl < br) {
int mid = bl + (br-bl)/2;
cout << "examine " << x << " " << y+mid << endl;
cin >> s;
if(s[0] == 't') {
bl = mid+1;
} else {
br = mid;
}
}
yr = y+bl-1;
yl = yr-m+1;
int cx = (xl+xr)/2;
int cy = (yl+yr)/2;
int rb=0, ub=0;
for(int i=4; i>0; i--) {
for(int j=-1; j<2; j++) {
cout << "examine " << cx+(i*m) << " " << cy+(j*m) << endl;
cin >> s;
if(s[0] == 't') {
rb = i;
goto jump;
}
}
}
jump:;
for(int i=4; i>0; i--) {
for(int j=-1; j<2; j++) {
cout << "examine " << cx+(j*m) << " " << cy+(i*m) << endl;
cin >> s;
if(s[0] == 't') {
ub = j;
goto jump2;
}
}
}
jump2:;
cout << cx+((rb-2)*m) << " " << n-cy+((ub-2)*m)+1 << "\n";
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... |