#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef pair<int,int> pii;
int n;
int qtd;
bool check(lli X, lli Y)
{
if( X > n || Y > n ) return false;
if( X <= 0 || Y <= 0 ) return false;
assert( qtd < 300 );
cout << "examine " << X << " " << Y << endl;
qtd++;
string s;
cin >> s;
return s[0] == 't';
}
pii bs(pii p, int dx, int dy)
{
lli L = 0;
lli R = n;
lli X = p.first;
lli Y = p.second;
while( R - L > 1 )
{
lli m = ( L + R )/2;
if( check( X + m*dx , Y + m*dy ) ) L = m;
else R = m;
}
return { X + L*dx , Y + L*dy };
}
pii middleDiagonal(pii p, int dx, int dy)
{
pii E1 = bs( p , dx , dy );
pii E2 = bs( p , -dx , -dy );
lli X = E1.first + E2.first;
lli Y = E1.second + E2.second;
return { X/2 , Y/2 };
}
int main()
{
int X, Y;
cin >> n >> X >> Y;
pii curPoint = { X , Y };
curPoint = bs( curPoint , -1 , 0 );
curPoint = bs( curPoint , 0 , -1 );
curPoint = middleDiagonal( curPoint , 1 , 1 );
curPoint = middleDiagonal( curPoint , 1 , -1 );
cout << "solution " << curPoint.first << " " << curPoint.second << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
3 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
4 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
404 KB |
Output is correct |
2 |
Correct |
4 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
4 ms |
292 KB |
Output is correct |
3 |
Correct |
3 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
3 ms |
376 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
248 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |