# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
792738 | Warinchai | Aliens (IOI07_aliens) | C++14 | 1 ms | 288 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,x,y;
cin>>n>>x>>y;
int lm=1,rm=1;
while(lm+x<=n){
cout<<"examine "<<lm+x<<" "<<y<<endl;
bool hv;
cin>>hv;
if(hv==false){
break;
}
lm=lm*2;
}
//cout<<"lm:"<<lm<<endl;
int en=lm+x;
int st=x+(lm/2);
int ansr=0;
if(lm+x>n){
en=n;
}
while(st<=en){
int m=(st+en)/2;
cout<<"examine "<<m<<" "<<y<<endl;
bool hv;
cin>>hv;
if(hv){
ansr=m;
st=m+1;
}else{
en=m-1;
}
}
//cout<<"ansr:"<<ansr<<endl;
//end
while(x-rm>=1){
cout<<"examine "<<x-rm<<" "<<y<<endl;
bool hv;
cin>>hv;
if(hv==false){
break;
}
rm=rm*2;
}
//cout<<"rm:"<<rm<<endl;
st=x-rm;
en=x-(rm/2);
int ansl=0;
if(x-rm<1){
st=1;
}
while(st<=en){
int m=(st+en)/2;
cout<<"examine "<<m<<" "<<y<<endl;
bool hv;
cin>>hv;
if(hv){
ansl=m;
en=m-1;
}else{
st=m+1;
}
}
//cout<<"ansl:"<<ansl<<endl;
int sz=(ansr-ansl+1);
//cout<<"sz:"<<sz<<endl;
int stx,sty;
st=0,en=sz;
while(st<=en){
int m=(st+en)/2;
if(ansl-m*sz<1){
en=m-1;
continue;
}
int sq=ansl-m*sz;
cout<<"examine "<<sq<<" "<<y<<endl;
int hv;
cin>>hv;
if(hv==true){
stx=sq;
st=m+1;
}else{
en=m-1;
}
}
//cout<<"starting of x"<<stx<<endl;
st=y-sz,en=y;
if(st<1){
st=1;
}
int ansu;
while(st<=en){
int m=(st+en)/2;
cout<<"examine "<<x<<" "<<m<<endl;
bool hv;
cin>>hv;
if(hv){
ansu=m;
en=m-1;
}else{
st=m+1;
}
}
//cout<<"start of little square y:"<<ansu<<endl;
st=0,en=sz;
while(st<=en){
int m=(st+en)/2;
if(ansu-m*sz<1){
en=m-1;
continue;
}
int sq=ansu-m*sz;
cout<<"examine "<<x<<" "<<sq<<endl;
int hv;
cin>>hv;
if(hv==true){
sty=sq;
st=m+1;
}else{
en=m-1;
}
}
//cout<<"start of y:"<<sty<<endl;
int add;
add=(sz)/2;
add=add*sz*2;
add+=sz/2;
cout<<"solution "<<stx+add<<" "<<sty+add<<endl;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |