답안 #1028727

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1028727 2024-07-20T07:45:54 Z TitanicXDzz Aliens (IOI07_aliens) C++14
90 / 100
1 ms 344 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
long long int n,xx,yy;
int che=1;
cin>>n>>xx>>yy;
long long j=2;
string s;
while(che==1){
    cout<<j;
    che=0;
    if(xx+j-1<=n){
      cout<<"examine"<<" "<<xx+j-1<<" "<<yy<<endl;
      cin>>s;
      if(s[0]=='t')
        che=1;
    }
    if(che==1)
        j*=2;
}
int l=j/2-1;
int r=min(n-xx,j-2);
while(l!=r){
    int mid=(l+r+1)/2;
    cout<<"examine"<<" "<<xx+mid<<" "<<yy<<endl;
    string s;
    cin>>s;
    if(s[0]=='t')
        l=mid;
    else
        r=mid-1;
}
cout<<l;
j=2;
che=1;
while(che==1){
    che=0;
    if(xx-j+1>=0){
      cout<<"examine"<<" "<<xx-j+1<<" "<<yy<<endl;
      cin>>s;
      if(s[0]=='t')
        che=1;
    }
    if(che==1)
        j*=2;
}
cout<<j;
int ll=j/2-1;
int rr=min(xx-1,j-2);
while(ll!=rr){
    int mid=(ll+rr+1)/2;
    cout<<"examine"<<" "<<xx-mid<<" "<<yy<<endl;
    string s;
    cin>>s;
    if(s[0]=='t')
        ll=mid;
    else
        rr=mid-1;
}
int m=ll+l+1;
int x=(xx-ll+xx+l)/2;
che=1;
j=2;
while(che==1){
    che=0;
    if(yy+j-1<=n){
      cout<<"examine"<<" "<<xx<<" "<<yy+j-1<<endl;
      cin>>s;
      if(s[0]=='t')
        che=1;
    }
    if(che==1)
        j*=2;
}
l=j/2-1;
r=min(n-yy,j-2);
while(l!=r){
    int mid=(l+r+1)/2;
    cout<<"examine"<<" "<<xx<<" "<<yy+mid<<endl;
    string s;
    cin>>s;
    if(s[0]=='t')
        l=mid;
    else
        r=mid-1;
}
int y=yy+l-(m/2);
cout<<x<<y;
che=0;
if(x+2*m<=n){
    string s;
    cout<<"examine"<<" "<<x+2*m<<" "<<y<<endl;
    cin>>s;
    if(s[0]=='t')
        che=1;
}
if(che==0){
  che=0;
  if(y+2*m<=n){
    string s;
    cout<<"examine"<<" "<<x<<" "<<y+2*m<<endl;
    cin>>s;
    if(s[0]=='t')
        che=1;
  }
    if(che==0){
        che=0;
        if(x-4*m>0){
            string s;
    cout<<"examine"<<" "<<x-4*m<<" "<<y<<endl;
    cin>>s;
    if(s[0]=='t')
        che=1;
        }
      if(che==0){
        x-=m;
        y-=m;
        cout<<"solution"<<" "<<x<<" "<<y<<endl;
        return 0;
      }
      if(che==1){
        x-=2*m;
        y-=2*m;
        cout<<"solution"<<" "<<x<<" "<<y<<endl;
        return 0;
      }
    }
    else{
        che=0;
        if(y-2*m>0){
            string s;
    cout<<"examine"<<" "<<x<<" "<<y-2*m<<endl;
    cin>>s;
    if(s[0]=='t')
        che=1;
        }
     if(che==0){
        if(x-4*m>0){
            string s;
    cout<<"examine"<<" "<<x-4*m<<" "<<y<<endl;
    cin>>s;
    if(s[0]=='t')
        che=1;
        }
      if(che==0){
        x-=m;
        y+=m;
        cout<<"solution"<<" "<<x<<" "<<y<<endl;
        return 0;
      }
      else{
        x-=2*m;
        y+=2*m;
        cout<<"solution"<<" "<<x<<" "<<y<<endl;
        return 0;
      }
     }
     else{
        x-=2*m;
        cout<<"solution"<<" "<<x<<" "<<y<<endl;
        return 0;
     }
    }
  }
else{
    cout<<"166";
    che=0;
    if(y+2*m<=n){
        string s;
    cout<<"examine"<<" "<<x<<" "<<y+2*m<<endl;
    cin>>s;
    if(s[0]=='t')
        che=1;
    }
    if(che==0){
        if(x-2*m>0){
            string s;
    cout<<"examine"<<" "<<x-2*m<<" "<<y<<endl;
    cin>>s;
    if(s[0]=='t')
        che=1;
    }
    if(che==0){
        if(x+4*m<=n){
            string s;
    cout<<"examine"<<" "<<x+4*m<<" "<<y<<endl;
    cin>>s;
    if(s[0]=='t')
        che=1;
        }
     if(che==0){
        x+=m;
        y-=m;
        cout<<"solution"<<" "<<x<<" "<<y<<endl;
        return 0;
     }
     else{
        x+=2*m;
        y-=2*m;
        cout<<"solution"<<" "<<x<<" "<<y<<endl;
     return 0;
     }
    }
    else{
        y-=2*m;
        cout<<"solution"<<" "<<x<<" "<<y<<endl;
        return 0;
    }
    }
    else{
        cout<<"211";
        che=0;
        if(x-2*m>0){
            string s;
    cout<<"examine"<<" "<<x-2*m<<" "<<y<<endl;
    cin>>s;
    if(s[0]=='t')
        che=1;
        }
        if(che==0){
            cout<<"221";
            if(y-2*m>0){
                 string s;
    cout<<"220examine"<<" "<<x<<" "<<y-2*m<<endl;
    cin>>s;
    if(s[0]=='t')
        che=1;
            }
            if(che==0){
                if(x-m>0&&y-m>0){
                     string s;
    cout<<"examine"<<" "<<x-m<<" "<<y-m<<endl;
    cin>>s;
    if(s[0]=='t')
        che=1;
                }
                if(che==0){
                    x+=2*m;
                    y+=2*m;
                    cout<<"solution"<<" "<<x<<" "<<y<<endl;
                    return 0;
                }
                else{
                    x+=m;
                    y+=m;
                    cout<<"solution"<<" "<<x<<" "<<y<<endl;
                    return 0;
                }
            }
            else{
                cout<<"solution"<<" "<<x+2*m<<" "<<y<<endl;
                    return 0;
            }
        }
        else{
            che=0;
            if(y-2*m>0){
                string s;
    cout<<"examine"<<" "<<x<<" "<<y-2*m<<endl;
    cin>>s;
    if(s[0]=='t')
        che=1;
            }
            if(che==0){
                cout<<"solution"<<" "<<x<<" "<<y+2*m<<endl;
                    return 0;
            }
            else{
                cout<<"solution"<<" "<<x<<" "<<y<<endl;
                    return 0;
            }
        }
    }
}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Unexpected end of file - token expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct