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 nyahalo ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define otsumiko exit(0);
#define mikodanye priority_queue<pair<long long, long long>, vector<pair<long long, long long> >, greater<pair<long long, long long> > >
#define mikochi priority_queue<long long, vector<long long>, greater<long long> >
long long n, m, ux, uy, bx, by, x, y, mx, my, xc, yc, ci, cj, nl, nr, nu, nb, dx, dy, lx, ly;
string qs = "examine", rp, so = "solution";
bool qr(long long cx, long long cy) {
if (cx>n || cx<1 || cy>n || cy<1) {
return 0;
}
cout << qs << " " << cx << " " << cy << "\n" << flush;
cin >> rp;
if (rp[0] == 't') {
return 1;
}
return 0;
}
int main() {
nyahalo
long long i, j, x0, y0, x1, x2, y1, y2;
cin >> n >> x0 >> y0;
x1 = x0;
y1 = y0;
x2 = x0;
y2 = y0;
m = 1;
x = x0+1;
y = y0;
while (qr(x, y)) {
m++;
x2 = x;
x++;
}
x = x0-1;
y = y0;
while (qr(x, y)) {
m++;
x1 = x;
x--;
}
x = x0;
y = y0+1;
while (qr(x, y)) {
y2 = y;
y++;
}
x = x0;
y = y0-1;
while (qr(x, y)) {
y1 = y;
y--;
}
mx = (x1+x2)/2;
my = (y1+y2)/2;
//cout << "mx: " << mx << " my: " << my << "\n" << flush;
x = mx-2*m;
y = my;
nl = 0;
while (qr(x, y)) {
nl++;
x -= 2*m;
}
nr = 0;
x = mx+2*m;
y = my;
while (qr(x, y)) {
nr++;
x += 2*m;
}
if (nl == 0) {
if (nr == 2) {
cj = 1;
} else {
cj = 2;
}
}
if (nl == 1) {
if (nr == 1) {
cj = 3;
} else {
cj = 4;
}
}
if (nl == 2) {
cj = 5;
}
nu = 0;
nb = 0;
x = mx;
y = my+2*m;
while (qr(x, y)) {
nu++;
y += 2*m;
}
x = mx;
y = my-2*m;
while (qr(x, y)) {
nb++;
y -= 2*m;
}
if (nu == 0) {
if (nb == 2) {
ci = 1;
} else {
ci = 2;
}
}
if (nu == 1) {
if (nb == 1) {
ci = 3;
} else {
ci = 4;
}
}
if (nu == 2) {
ci = 5;
}
ci = 5-ci+1;
dx = 3-cj;
dy = 3-ci;
xc = mx+dx*m;
yc = my+dy*m;
//cout << "ci: " << ci << " cj: " << cj << "\n";
cout << so << " " << xc << " " << yc << "\n" << flush;
otsumiko
}
Compilation message (stderr)
aliens.cpp: In function 'int main()':
aliens.cpp:26:13: warning: unused variable 'i' [-Wunused-variable]
26 | long long i, j, x0, y0, x1, x2, y1, y2;
| ^
aliens.cpp:26:16: warning: unused variable 'j' [-Wunused-variable]
26 | long long i, j, x0, y0, x1, x2, y1, y2;
| ^
# | 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... |