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 ll long long
#define sz size()
#define ff first
#define ss second
#define pb push_back
#define pii pair <int, int>
const int N = 2e5 + 5;
int aa[] = { 0, 2, 3, 1, 3, 0, 2, 4, 1, 3, 0, 2, 4 };
int bb[] = { 0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4 };
int n, sorag = 0;
bool ask (int jj, int kk) {
if (jj > n or kk > n) return 0;
if (jj < 1 or kk < 1) return 0;
sorag++;
assert (sorag <= 300);
cout << "examine " << jj << " " << kk << endl;
string s;
cin >> s;
if (s[0] == 't') return 1;
return 0;
}
bool barla (int x, int y, int m) {
if (ask (x, y) == 1 and ask(x + 5 * m - 1, y) == 1 and ask (x, y - 5 * m + 1) == 1 and ask (x + 5 * m - 1, y - 5 * m + 1) == 1) {
return 1;
}
return 0;
}
int x, y;
int main () {
// freopen ("input.txt", "r", stdin);
// ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int a, b;
cin >> n >> a >> b;
int m = 1;
int l = a, r = a;
while (l > 1) {
l--;
if (!ask(l, b)) {
l++;
break;
}
m++;
}
while (r < n) {
r++;
if (!ask(r, b)) {
r--;
break;
}
m++;
}
int l1 = b, r1 = b;
while (l1 > 1) {
l1--;
if (!ask(a, l1)) {
l1++;
break;
}
}
while (r < n) {
r1++;
if (!ask(a, r1)) {
r1--;
break;
}
}
x = l;y = r1;
// cout << l << " " << r << " " << l1 << " " << r1 << "\n";
// return 0;
// return cout << x << " " << y << " " << m, 0;
for (int j = 0; j < 13; ++j) {
if (barla (x - m * aa[j], y + m * bb[j], m)) {
return cout << "solution "<< (x - m * aa[j]) + 3 * m - 2 << " " << (y + m * bb[j]) - 3 * m + 2, 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... |