답안 #792763

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
792763 2023-07-25T08:34:56 Z Warinchai Aliens (IOI07_aliens) C++14
0 / 100
1 ms 208 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 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:129:28: warning: 'stx' may be used uninitialized in this function [-Wmaybe-uninitialized]
  129 |     cout<<"solution "<<stx+add<<" "<<sty+add<<endl;
      |                            ^~~
aliens.cpp:129:42: warning: 'sty' may be used uninitialized in this function [-Wmaybe-uninitialized]
  129 |     cout<<"solution "<<stx+add<<" "<<sty+add<<endl;
      |                                          ^~~
aliens.cpp:109:16: warning: 'ansu' may be used uninitialized in this function [-Wmaybe-uninitialized]
  109 |         if(ansu-m*sz<1){
      |            ~~~~^~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Expected int32, but "159999999000000002" found
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -