# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
792833 | Warinchai | Aliens (IOI07_aliens) | C++14 | 2 ms | 256 KiB |
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<bits/stdc++.h>
using namespace std;
int main(){
long long n,x,y;
cin>>n>>x>>y;
long long lm=1,rm=1;
while(lm+x<=n){
cout<<"examine "<<lm+x<<" "<<y<<endl;
string hv;
cin>>hv;
if(hv=="false"){
break;
}
lm=lm*2;
}
//cout<<"lm:"<<lm<<endl;
long long en=lm+x;
long long st=x+(lm/2);
long long ansr=0;
if(lm+x>n){
en=n;
}
while(st<=en){
long long m=(st+en)/2;
cout<<"examine "<<m<<" "<<y<<endl;
string hv;
cin>>hv;
if(hv=="true"){
ansr=m;
st=m+1;
}else{
en=m-1;
}
}
//cout<<"ansr:"<<ansr<<endl;
//end
while(x-rm>=1){
cout<<"examine "<<x-rm<<" "<<y<<endl;
string hv;
cin>>hv;
if(hv=="false"){
break;
}
rm=rm*2;
}
//cout<<"rm:"<<rm<<endl;
st=x-rm;
en=x-(rm/2);
long long ansl=0;
if(x-rm<1){
st=1;
}
while(st<=en){
long long m=(st+en)/2;
cout<<"examine "<<m<<" "<<y<<endl;
string hv;
cin>>hv;
if(hv=="true"){
ansl=m;
en=m-1;
}else{
st=m+1;
}
}
//cout<<"ansl:"<<ansl<<endl;
long long sz=(ansr-ansl+1);
//cout<<"sz:"<<sz<<endl;
long long stx,sty;
st=0,en=sz;
while(st<=en){
long long m=(st+en)/2;
if(ansl-m*sz<1){
en=m-1;
continue;
}
long long sq=ansl-m*sz;
cout<<"examine "<<sq<<" "<<y<<endl;
string 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;
}
long long ansu;
while(st<=en){
long long m=(st+en)/2;
cout<<"examine "<<x<<" "<<m<<endl;
string hv;
cin>>hv;
if(hv=="true"){
ansu=m;
en=m-1;
}else{
st=m+1;
}
}
//cout<<"start of little square y:"<<ansu<<endl;
st=0,en=sz;
while(st<=en){
long long m=(st+en)/2;
if(ansu-m*sz<1){
en=m-1;
continue;
}
long long sq=ansu-m*sz;
cout<<"examine "<<x<<" "<<sq<<endl;
string hv;
cin>>hv;
if(hv=="true"){
sty=sq;
st=m+1;
}else{
en=m-1;
}
}
//cout<<"start of y:"<<sty<<endl;
long long add;
add=(sz)/2;
add=add*sz*2;
add+=sz/2;
//long long runtimeerror=1/0;
//cout<<"solution "<<runtimeerror<<" "<<runtimeerror<<endl;
cout<<"solution "<<stx+add<<" "<<sty+add;
}
Compilation message (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... |