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 main() {
ios::sync_with_stdio(false);
cin.tie(0);
long long n, x_0, y_0;
cin >> n >> x_0 >> y_0;
for (int i = 1; i <= 400; i++) {
cout << "examine 1 1" << endl;
string s;
cin >> s;
}
int k = -1;
string s;
do {
k++;
cout << "examine " << x_0 + (1ll << k) << ' ' << y_0 << endl;
cin >> s;
} while (s == "true");
long long lo = x_0, hi = x_0 + (1ll << k);
while (lo < hi) {
long long mid = (lo + hi + 1) / 2;
cout << "examine " << mid << ' ' << y_0 << endl;
cin >> s;
if (s == "true") {
lo = mid;
} else {
hi = mid - 1;
}
}
long long x_r = lo;
k = -1;
do {
k++;
cout << "examine " << x_0 << ' ' << y_0 + (1ll << k) << endl;
cin >> s;
} while (s == "true");
lo = y_0, hi = y_0 + (1ll << k);
while (lo < hi) {
long long mid = (lo + hi + 1) / 2;
cout << "examine " << x_0 << ' ' << mid << endl;
cin >> s;
if (s == "true") {
lo = mid;
} else {
hi = mid - 1;
}
}
long long y_r = lo;
k = -1;
do {
k++;
cout << "examine " << x_0 - (1ll << k) << ' ' << y_0 << endl;
cin >> s;
} while (s == "true");
lo = x_0 - (1ll << k), hi = x_0;
while (lo < hi) {
long long mid = (lo + hi) / 2;
cout << "examine " << mid << ' ' << y_0 << endl;
cin >> s;
if (s == "true") {
hi = mid;
} else {
lo = mid + 1;
}
}
long long x_l = lo;
long long m = x_r - x_l + 1;
x_0 = x_r - (m - 1) / 2;
y_0 = y_r - (m - 1) / 2;
vector<bool> x(5, false);
for (int i = -2; i <= 2; i++) {
if (x_0 + 2 * i * m < 1 || x_0 + 2 * i * m > n) {
continue;
}
cout << "examine " << x_0 + 2 * i * m << ' ' << y_0 << endl;
cin >> s;
x[i + 2] = (s == "true");
}
vector<bool> y(5, false);
for (int i = -2; i <= 2; i++) {
if (y_0 + 2 * i * m < 1 || y_0 + 2 * i * m > n) {
continue;
}
cout << "examine " << x_0 << ' ' << y_0 + 2 * i * m << endl;
cin >> s;
y[i + 2] = (s == "true");
}
if (x[3] && x[4]) {
x_0 += 2 * m;
} else if (x[0] && x[1]) {
x_0 -= 2 * m;
} else if (x[1] && !x[3]) {
x_0 -= m;
} else {
x_0 += m;
}
if (y[3] && y[4]) {
y_0 += 2 * m;
} else if (y[0] && y[1]) {
y_0 -= 2 * m;
} else if (y[1] && !y[3]) {
y_0 -= m;
} else {
y_0 += m;
}
cout << "solution " << x_0 << ' ' << y_0 << endl;
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... |