Submission #1339070

#TimeUsernameProblemLanguageResultExecution timeMemory
1339070po_rag526Aliens (IOI07_aliens)C++20
0 / 100
0 ms344 KiB
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl '\n'
void ex(int a , int b){
    cout<<"examine "<<a<<" "<< b<<endl;
}
void sol(){
    bool rgrass = true;
    bool lgrass =true;
    int n,x0,y0;
    int rm=1;
    int lm =1;
    cin >>n>>x0>>y0;
    int i=0;

    while(x0 + pow(2,i) <= n){
        ex(x0 + pow(2,i) , y0);
        string s;
        bool dorms = false;
        cin>>s;
        if(s[0] == 't'){
            i+=1;
            if(x0 + pow(2,i) > n) dorms = true;
        }
        if(dorms || s[0] == 'f'){
            int j=1;
            while(rgrass){
                ex(x0+ pow(2,i-1) + j , y0);
                string s1;
                cin>>s1;
                if(s1[0]=='f'){
                    rm = pow(2,i-1)+j;
                    rgrass=false;
                    break; 
                }else  j+=1;
            }
        }
    }
    i=0;
    bool dorm = false;
    bool br = true;
    bool bl = true;
    while(x0 - pow(2,i) >= 1){
        ex(x0 - pow(2,i) , y0);
        string s;
        cin>>s;
        if(s[0] == 't') {
            i+=1;
            if(x0 - pow(2,i)  < 1){
                dorm = true;
            }
        }
        if(dorm || s[0] == 'f'){
            int j=1;
            while(lgrass){
                ex(x0 -pow(2,i-1) - j , y0);
                string s1;
                cin>>s1;
                if(s1[0]=='f'){
                    lm = pow(2,i-1) +j;
                    lgrass= false;
                    break;
                }else  j+=1;
            }
        }
    }
    int m = lm + rm-1;
    int um =0;
    int dm = 0;
    i=0;
//hereeeeeeejfezhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
    while(y0 + pow(2,i) <= n){
        ex(x0, y0 + pow(2,i) );
        string s;
        bool dorms = false;
        cin>>s;
        if(s[0] == 't'){
            i+=1;
            if(y0 + pow(2,i) > n) dorms = true;
        }
        if(dorms || s[0] == 'f'){
            int j=1;
            while(rgrass){
                ex(x0, y0+ pow(2,i-1) + j );
                string s1;
                cin>>s1;
                if(s1[0]=='f'){
                    um = pow(2,i-1)+j;
                    rgrass=false;
                    break; 
                }else  j+=1;
            }
        }
    }
    dm = m-um+1;
    bool rb = false;
    // rm , dm , um ; lm
    int cx= (m-2*x0-2)/2 +1;
    int cy= (m-2*x0 -2)/2 +1;
    bool ad = false;
    if(x0 + 2*m<=n){
        string w;
        ex(x0+2*m , y0);
        cin>>w;
        if(w[0] =='f') ad=true;
    }
    if(x0 + m >n || ad ){
        rb=true;
        if(y0 + 2*m >n){
            cout<<"solution "<<cx- 2*m<<" "<<cy - 2*m;
        }else{
            ex(x0, y0 +2*m);
            string  w;
            cin>>w;
            if(w[0]=='f'){
                cout<<"solution "<<cx- 2*m<<" "<<cy - 2*m;
            }else{
                if(y0 - 2*m <=0) cout<<"solution "<<cx- 2*m<<" "<<cy + 2*m;
                else{
                    ex(x0, y0 -2*m);
                    string w;
                    cin>>w;
                    if(w[0]=='f') cout<<"solution "<<cx- 2*m<<" "<<cy + 2*m;
                    else cout<<"solution "<<cx- 2*m<<" "<<cy + 2*m;
                }
            }

        }
    }
    /////////////////////////chappp 2 :                         
    ad = false;
    if(x0 - 2*m<=n){
        string w;
        ex(x0-2*m , y0);
        cin>>w;
        if(w[0] =='f') ad=true;
    }
    if(x0 - m >n || ad ){
        rb=true ;
        if(y0 + 2*m >n){
            cout<<"solution "<<cx+ 2*m<<" "<<cy - 2*m;
        }else{
            ex(x0, y0 +2*m);
            string  w;
            cin>>w;
            if(w[0]=='f'){
                cout<<"solution "<<cx+ 2*m<<" "<<cy - 2*m;
            }else{
                if(y0 - 2*m <=0) cout<<"solution "<<cx+ 2*m<<" "<<cy + 2*m;
                else{
                    ex(x0, y0 -2*m);
                    string w;
                    cin>>w;
                    if(w[0]=='f') cout<<"solution "<<cx+ 2*m<<" "<<cy + 2*m;
                    else cout<<"solution "<<cx+ 2*m<<" "<<cy + 2*m;
                }
            }

        }
    }



    ///////////////////chappp 3 :         

    if(!rb ){
        if(y0 + 2*m >n){
            cout<<"solution "<<cx<<" "<<cy - 2*m;
        }else{
            ex(x0, y0 +2*m);
            string  w;
            cin>>w;
            if(w[0]=='f'){
                cout<<"solution "<<cx<<" "<<cy - 2*m;
            }else{
                if(y0 - 2*m <=0) cout<<"solution "<<cx<<" "<<cy + 2*m;
                else{
                    ex(x0, y0 -2*m);
                    string w;
                    cin>>w;
                    if(w[0]=='f') cout<<"solution "<<cx<<" "<<cy + 2*m;
                    else cout<<"solution "<<cx<<" "<<cy + 2*m;
                }
            }

        }
    }



}


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    int t=1;
    while(t--) sol();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...