#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, x0, y0;
cin >> x0 >> y0;
int lr = x0, hr = n;
while(lr<hr){
int m = lr+(hr-lr+1)/2;
int m1 = lr+(m-lr)/2, m2 = lr+(m-lr)/4;
cout << "examine " << m << " " << y0 << endl;
string s; cin >> s;
if(s == "false"){
hr = m-1;
continue;
}
cout << "examine " << m1 << " " << y0 << endl;
string s1; cin >> s1;
if(s1 == "false"){
hr = m-1;
continue;
}
cout << "examine " << m2 << " " << y0 << endl;
string s2; cin >> s2;
if(s2 == "false"){
hr = m-1;
continue;
}
else{
lr = m;
}
}
int ll = 1, hl = x0;
while(ll<hl){
int m = hl-(hl-ll+1)/2;
int m1 = hl-(hl-m)/2, m2 = hl-(hl-m)/4;
cout << "examine " << m << " " << y0 << endl;
string s; cin >> s;
if(s == "false"){
ll = m+1;
continue;
}
cout << "examine " << m1 << " " << y0 << endl;
string s1; cin >> s1;
if(s1 == "false"){
ll = m+1;
continue;
}
cout << "examine " << m2 << " " << y0 << endl;
string s2; cin >> s2;
if(s2 == "false"){
ll = m+1;
continue;
}
else{
hl = m;
}
}
int lt = y0, ht = n;
while(lt<ht){
int m = lt+(ht-lt+1)/2;
int m1 = lt+(m-lt)/2, m2 = lt+(m-lt)/4;
cout << "examine " << x0 << " " << m << endl;
string s; cin >> s;
if(s == "false"){
ht = m-1;
continue;
}
cout << "examine " << x0 << " " << m1 << endl;
string s1; cin >> s1;
if(s1 == "false"){
ht = m-1;
continue;
}
cout << "examine " << x0 << " " << m2 << endl;
string s2; cin >> s2;
if(s2 == "false"){
ht = m-1;
continue;
}
else{
lt = m;
}
}
int lx = lr, rx = hl, ty = lt, by = ty-lx+rx;
int m = lx-rx+1;
int x1 = (lx+rx)/2, y1 = (ty+by)/2;
long long largeleft = x1+2*m, largeright = x1-2*m, largetop = y1+2*m, largebottom = y1-2*m;
while(largetop <= n){
cout << "examine " << x1 << " " << largetop << endl;
string s; cin >> s;
if(s == "false"){
break;
}
else largetop += 2*m;
}
while(largeleft <= n){
cout << "examine " << largeleft << " " << y1 << endl;
string s; cin >> s;
if(s=="false") break;
else largeleft += 2*m;
}
while(largeright >= 1){
cout << "examine " << largeright << " " << y1 << endl;
string s; cin >> s;
if(s=="false") break;
else largeright -= 2*m;
}
while(largebottom >= 1){
cout << "examine " << x1 << " " << largebottom << endl;
string s; cin >> s;
if(s == "false") break;
else largebottom -= 2*m;
}
cout << "solution " << (largeright+largeleft)/2 << " " << (largetop+largebottom)/2 << endl;
}
Compilation message
aliens.cpp: In function 'int main()':
aliens.cpp:91:23: warning: 'n' may be used uninitialized in this function [-Wmaybe-uninitialized]
91 | while(largetop <= n){
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
512 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |