답안 #792777

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
792777 2023-07-25T08:40:07 Z Warinchai Aliens (IOI07_aliens) C++14
0 / 100
2 ms 464 KB
#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 runtimeerror=1/0;
    cout<<"solution "<<runtimeerror<<" "<<runtimeerror<<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;
    cout<<"solution "<<stx+add<<" "<<sty+add<<endl;
}

Compilation message

aliens.cpp: In function 'int main()':
aliens.cpp:68:29: warning: division by zero [-Wdiv-by-zero]
   68 |     long long runtimeerror=1/0;
      |                            ~^~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 432 KB Execution killed with signal 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 336 KB Execution killed with signal 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 4
2 Halted 0 ms 0 KB -