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 <iostream>
using namespace std;
int n,x,y;
bool ask(int x,int y){
if(x < 1 || x > n || y < 1 || y > n){
return false;
}
string ans;
cout << "examine " << x << " " << y << endl;
cin >> ans;
return (ans == "true");
}
void answer(int x,int y){
cout << "solution " << x << " " << y << endl;
}
int main(){
cin >> n >> x >> y;
int delta = 1;
while(ask(x,y + delta) == true){
delta *= 2;
}
delta /= 2;
for(;delta;delta /= 2){
if(ask(x,y + delta) == true){
y += delta;
}
}
delta = 1;
while(ask(x + delta,y) == true){
delta *= 2;
}
delta /= 2;
for(;delta;delta /= 2){
if(ask(x + delta,y) == true){
x += delta;
}
}
delta = 1;
while(ask(x - delta,y) == true){
delta *= 2;
}
delta /= 2;
int m = 0;
for(;delta;delta /= 2){
if(ask(x - m - delta,y) == true){
m += delta;
}
}
m++;
x -= (m / 2);
y -= (m / 2);
while(ask(x - m,y - m)){
x -= m;
y -= m;
}
while(ask(x - m,y)){
x -= m;
}
while(ask(x,y - m)){
y - m;
}
x += 2 * m;
y += 2 * m;
answer(x,y);
return 0;
}
Compilation message (stderr)
aliens.cpp: In function 'int main()':
aliens.cpp:81:11: warning: statement has no effect [-Wunused-value]
y - m;
~~^~~
# | 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... |