# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1107254 |
2024-11-01T05:27:20 Z |
jadai007 |
Aliens (IOI07_aliens) |
C++17 |
|
0 ms |
0 KB |
#include<bits/stdc++.h>
using namespace std;
int n, xo, yo;
string ck;
bool check(int x, int y){
if(x < 1 || x > n || y < 1 || y > n) return false;
cout << "examine " << x << ' ' << y << endl;
cin >> ck;
if(ck == "false") return false;
return true;
}
int main(){
cin >> n >> xo >> yo;
int lx = xo, ly = yo, x, y;
for(int j = 0; j < 3; ++j){
for(int i = 31; i >= 0; --i){
x = lx - (1<<i), y = ly;
if(check(x, y)) lx = x, ly = y;
}
}
for(int j = 0; j < 3; ++j){
for(int i = 31; i >= 0; --i){
x = lx, y = ly = y - (1<<i);
if(check(x, y)) lx = x, ly = y;
}
}
for(int i = 31; i >= 0; --i){
x = lx - (1<<i), y = ly - (1<<i);
if(check(x, y)) lx = x, ly = y;
}
int rx = lx;
for(int i = 31; i >= 0; --i){
int cx = rx + (1<<i);
if(check(cx, ly)) rx = cx;
}
int sz = rx - lx + 1;
int ry += (sz - 1);
cout << "solution " << (lx + rx)/2 << ' ' << (ly + ry)/2;
}
Compilation message
aliens.cpp: In function 'int main()':
aliens.cpp:41:12: error: expected initializer before '+=' token
41 | int ry += (sz - 1);
| ^~
aliens.cpp:42:56: error: 'ry' was not declared in this scope; did you mean 'rx'?
42 | cout << "solution " << (lx + rx)/2 << ' ' << (ly + ry)/2;
| ^~
| rx
aliens.cpp:40:9: warning: unused variable 'sz' [-Wunused-variable]
40 | int sz = rx - lx + 1;
| ^~