이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n,x,y;cin>>n>>x>>y;
--x,--y;
auto examine = [&](int xx,int yy){
if (xx + 1 > n || yy + 1 > n || xx + 1<=0 || yy + 1<=0)return false;
cout<<"examine "<<xx + 1<<" "<<yy + 1<<endl;
string s;cin>>s;
return s == "true";
};
auto answer = [&](int xx,int yy){
cout<<"solution "<<xx + 1<<" "<<yy + 1<<endl;
};
while (true){
int pos = -1;
for (int i = 0;i<30;++i){
if (examine(x - (1<<i),y)){
pos = i;
}
else break;
}
if (pos == -1)break;
x-=(1<<pos);
}
int m = 0;
while (true){
int pos = -1;
for (int i = 0;i<30;++i){
if (examine(x + (1<<i) + m,y)){
pos = i;
}
else break;
}
if (pos == -1)break;
m+=(1<<pos);
}
while (true){
int pos = -1;
for (int i = 0;i<30;++i){
if (examine(x,y - (1<<i))){
pos = i;
}
else break;
}
if (pos == -1)break;
y-=(1<<pos);
}
//cout<<x<<" "<<y<<" "<<m<<'\n';
int levelx = 0;
if (examine(x + 4 * (m + 1) + m,y)){
levelx = 1;
}
else if (examine(x + 2 * (m + 1) + m,y)){
levelx = 2;
}
else levelx = 3;
int levely = 0;
if (examine(x,y + 4 * (m + 1) + m)){
levely = 1;
}
else if (examine(x,y + 2 * (m + 1) + m)){
levely = 2;
}
else levely = 3;
if (levelx == 1 && levely == 1){
answer(x + (m + 1) + m + (m + 2)/2, y + (m + 1) + m + (m + 2)/2);
}
else if (levelx == 1 && levely == 2){
answer(x + (m + 1) + m + (m + 2)/2, y + (m + 1)/2);
}
else if (levelx == 1 && levely == 3){
y+=m;
answer(x + (m + 1) + m + (m + 2)/2,y - (m + 1) + m + (m + 2)/2);
}
else if (levelx == 2 && levely == 1){
x+=(m + 1)/2;
answer(x,y + (m + 1) + m + (m + 2)/2);
}
else if (levelx == 2 && levely == 2){
if (examine(x + m + 4 * (m + 1),y + m + 4 * (m + 1))){
answer(x + m + (m + 2)/2,y + m + (m + 2)/2);
}
else{
answer(x + (m + 1)/2,y + (m + 1)/2);
}
}
else if (levelx == 2 && levely == 3){
if (examine(x - 4 * (m + 1),y)){
x += (m + 1)/2;
answer(x,y - (m + 1) - (m + 2)/2);
}
else{
y+=m;
answer(x + m + (m + 2)/2,y - m - (m + 2)/2);
}
}
else if (levelx == 3 && levely == 1){
x+=m;
answer(x - m - (m + 1) - (m + 2)/2,y + m + (m + 1) + (m + 2)/2);
}
else if (levelx == 3 && levely == 2){
if (examine(x - 2 * (m + 1),y - 2 * (m + 1))){
y +=(m + 1)/2;
answer(x - m - (m + 2)/2,y);
}
else{
y+=m;
answer(x - (m + 2)/2 , y + (m + 2)/2);
}
}
else if (levelx == 3 && levely == 3){
if (examine(x,y - 4 * (m + 1))){
answer(x - m - (m + 2)/2,y - m - (m + 2)/2);
}
else{
answer(x - (m + 2)/2,y - (m + 2)/2);
}
}
return 0;
}
# | 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... |