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 <iostream>
#include <string>
#include <algorithm>
using namespace std;
long long N, X0, Y0; //side of meadow, coordinates of one flattened square.
bool query(long long x, long long y)
{
if(x < 1 || N < x) return 0;
if(y < 1 || N < y) return 0;
cout << "examine " << x << ' ' << y << '\n';
string s;
cin >> s;
return (s == "true");
}
int main()
{
cin >> N >> X0 >> Y0;
long long l_edge, r_edge, b_edge, t_edge;
long long a, b, m;
//-----------------------------------------------
// cout << "part 1\n";
a = X0;
for(b = X0+1; b <= N; b += (b - X0))
{
if(query(b, Y0)) a = b;
else break;
}
b = min(b-1, N);
while(a != b)
{
m = (a+b)/2+1;
if(query(m, Y0)) a = m;
else b = m-1;
}
b_edge = a;
//-----------------------------------------------
// cout << "part 2\n";
a = Y0;
for(b = Y0+1; b <= N; b += (b - Y0))
{
if(query(X0, b)) a = b;
else break;
}
b = min(b-1, N);
while(a != b)
{
m = (a+b)/2+1;
if(query(X0, m)) a = m;
else b = m-1;
}
r_edge = a;
//-----------------------------------------------
// cout << "part 3\n";
b = Y0;
for(a = Y0-1; a >= 1; a -= (Y0 - a))
{
// cout << a << ' ' << query(X0, a) << '\n';
if(query(X0, a)) b = a;
else break;
}
a = max(a+1, 1LL);
// cout << a << '\n';
while(a != b)
{
// cout << a << ' ' << b << '\n';
m = (a+b)/2;
if(query(X0, m)) b = m;
else a = m+1;
}
// cout << a << '\n';
l_edge = b;
//-----------------------------------------------
int s = r_edge - (l_edge - 1);
cout << s << '\n';
t_edge = b_edge - s + 1;
cout << t_edge << ' ' << b_edge << ' ' << l_edge << ' ' << r_edge << '\n';
int cx = (t_edge + b_edge)/2;
int cy = (l_edge + r_edge)/2;
cout << cx << ' ' << cy << '\n';
bool query_top = query(cx - 2*s, cy);
bool query_down = query(cx + 2*s, cy);
bool query_left = query(cx, cy - 2*s);
bool query_right = query(cx, cy + 2*s);
cout << query_top << ' ' << query_down << ' ' << query_left << ' ' << query_right << '\n';
if(query_top) cx -= 2*s;
if(query_down) cx += 2*s;
if(query_left) cy -= 2*s;
if(query_right) cy += 2*s;
cout << "solution " << cx << ' ' << cy << '\n';
}
| # | 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... |