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 int long long
#define in array<int, 2>
#define pb push_back
#define pob pop_back
#define INF (int)1e17
#define MX (int)3e5+5
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
array<int, 4> gr[5][5];
array<int, 4> FF;
int N;
bool QQ(int x, int y)
{
if((x <= 0) || (y <= 0) || (x > N) || (y > N))
return false;
cout << "examine " << x << " " << y << endl;
string can; cin >> can;
return can=="true";
}
int dx[4] = {-1, 1, 0, 0}; int dy[4] = {0, 0, -1, 1};
int ddx[4] = {1, -1, 1, -1}; int ddy[4] = {1, 1, -1, -1};
signed main()
{
fast();
for(int i = 0; i < 5; i++)
{
for(int j = 0; j < 5; j++)
{
for(int k = 0; k < 4; k++)
{
int ip, jp; ip = i; jp = j;
while((ip >= 0) && (ip < 5) && (jp >= 0) && (jp < 5))
{
ip+=ddx[k];
jp+=ddy[k];
gr[i][j][k]++;
}
}
}
}
int x, y;
cin >> N >> x >> y;
int xp[4], yp[4];
for(int i = 0; i < 4; i++)
{
xp[i] = x;
yp[i] = y;
}
int pw = 1;
for(int i = 0; i < 3; i++)
{
while(true)
{
if(QQ(xp[i]+pw*dx[i], yp[i]+pw*dy[i]))
{
xp[i]+=(pw*dx[i]); yp[i]+=(pw*dy[i]);
pw*=2;
}
else
{
if(pw == 1)
break;
pw/=2;
}
}
}
//0 --> L; 1 --> R; 2 --> D
int K = (xp[1]-xp[0])/2;
int M = 2*K+1;
int Cx = xp[0]+K; int Cy = yp[2]+K;
for(int i = 0; i < 4; i++)
{
int Xp = Cx; int Yp = Cy;
while(QQ(Xp, Yp))
{
Xp+=(M*ddx[i]);
Yp+=(M*ddy[i]);
FF[i]++;
}
}
int cx = Cx; int cy = Cy;
for(int i = 0; i < 5; i++)
{
for(int j = 0; j < 5; j++)
{
if(FF == gr[i][j])
{
cx+=(M*(2-i));
cy+=(M*(2-j));
}
}
}
cout << "solution " << cx << " " << cy << 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... |