#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define taskname "A"
#define int ll
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
const int maxn = 1e5 + 5;
int n , m , x , y;
bool q(int i , int j){
if(i <= 0 || i > n || j <= 0 || j > n)return 0;
cout << "examine " << i << " " << j << endl;
string s;cin >> s;
return s[0] == 't';
}
int U , D , L , R;
int32_t main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> x >> y;
int l , h;
l = 1 , h = x;
while(l <= h){
int mid = l + h >> 1;
if(!q(mid,y))l = mid + 1;
else h = mid - 1;
}
D = l;
l = x , h = n;
while(l <= h){
int mid = l + h >> 1;
if(q(mid,y))l = mid + 1;
else h = mid - 1;
}
U = l;
l = 1 , h = y;
while(l <= h){
int mid = l + h >> 1;
if(!q(x,mid))l = mid + 1;
else h = mid - 1;
}
L = l;
l = y , h = n;
while(l <= h){
int mid = l + h >> 1;
if(q(x,mid))l = mid + 1;
else h = mid - 1;
}
R = l;
m = U - D;
if(m % 3 == 0 && !q(D+m/3,L))m /= 3;
else if(m % 5 == 0 && !q(D+m/5,L))m /= 5;
x = D + m / 2;y = L + m / 2;
int _x = 0 , cntx = 0 , _y = 0 , cnty = 0;
for(int i = -2 ; i <= 2 ; ++i){
if(q(i*2*m+x,y)){
cntx++;_x += i*2*m+x;
}
if(q(x,i*2*m+y)){
cnty++;_y += i*2*m+y;
}
}
cout << "solution " << _x / cntx << " " << _y / cnty;
}
Compilation message
aliens.cpp: In function 'int32_t main()':
aliens.cpp:30:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
int mid = l + h >> 1;
~~^~~
aliens.cpp:37:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
int mid = l + h >> 1;
~~^~~
aliens.cpp:44:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
int mid = l + h >> 1;
~~^~~
aliens.cpp:51:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
int mid = l + h >> 1;
~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
248 KB |
Output is correct |
2 |
Correct |
5 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
248 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
248 KB |
Output is correct |
2 |
Correct |
6 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
504 KB |
Output is correct |
2 |
Correct |
6 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
6 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
248 KB |
Output is correct |
2 |
Correct |
6 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
6 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
376 KB |
Output is correct |
2 |
Correct |
6 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
380 KB |
Output is correct |
2 |
Correct |
6 ms |
332 KB |
Output is correct |
3 |
Correct |
6 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
248 KB |
Output is correct |
2 |
Correct |
7 ms |
248 KB |
Output is correct |
3 |
Correct |
6 ms |
248 KB |
Output is correct |