제출 #1339115

#제출 시각아이디문제언어결과실행 시간메모리
1339115po_rag526Aliens (IOI07_aliens)C++20
0 / 100
1070 ms448 KiB
#include <bits/stdc++.h> 
using namespace std;
#define int long long
#define endl "\n"
bool in(pair<int,int> a,int n){
    return (a.first <= n && a.second >= 1) && (a.second <= n && a.second >= 1);
}
bool query(pair<int,int> a,int n){
    if(a.first < 1 || a.second < 1 || a.first > n || a.second > n)return false;
    cout<<"examine "<<a.first<<" "<<a.second<<endl;
    cout.flush();
    string c;cin>>c;
    if(c == "true")return true;
    return false;
}
void solve(){
    int n,x,y;cin>>n>>x>>y;
    int cnt = 1;
    while(true){
        if(x + cnt <= n){
            cout<<"examine "<<x+cnt<<" "<<y<<endl;
            cout.flush();
            string v;cin>>v;
            if(v == "true"){
                cnt++;
            }
            else{
                break;
            }
        }
        else break;
    }
    int oldcnt = cnt;
    int fah = 1;
    while(true){
        if(x - fah >= 1){
            cout<<"examine "<<x-fah<<" "<<y<<endl;
            cout.flush();
            string v;cin>>v;
            if(v == "true")fah++;
            else break;
        }
    }
    int m = fah+cnt-1;
    cnt = 1;
    int dist = 1;
    while(true){
        if(y + cnt <= n){
            cout<<"examine "<<x<<" "<<y+cnt<<endl;
            cout.flush();
            string v;cin>>v;
            if(v == "true"){
                cnt++;
                dist++;
            }
            else break;
        }
        else break;
    }
    pair<int,int> org = {(oldcnt)-m/2+x-1,(dist)-m/2+y-1};
    pair<int,int> cur = {(oldcnt)-m/2+x-1,(dist)-m/2+y-1};
    pair<int,int> cur2 = {(oldcnt)-m/2+x-1,(dist)-m/2+y-1};
    cout<<"M "<<m<<endl;
    cout<<org.first<<" "<<org.second<<endl;
    cout<<"fah"<<endl;
    cout<<"oldcnt "<<oldcnt<<endl;
    cout<<"dist "<<dist<<endl;
    cout.flush();
    //////////////////////////////////////////
    int bby = 0;
    int r = 0;
    //cur.first += 2*m;
    bool big = false;
    //determine if he is in the big ahh row
    bool f1 = false;
    bool f2 = false;
    bool f3 = false;
    cur.first += 4*m;
    if(in(cur,n)){
        if(query(cur,n))f1 = true;
    }
    cur.first -= 8*m;
    if(in(cur,n))if(query(cur,n))f3 = true;
    cur.first += 2*m;
    if(in(cur,n)){
        if(query(cur,n)){
        cur.first += 4*m;
        if(in(cur,n)){
            if(query(cur,n))f2 = true;
        }
        }
    }
    if(f1 || f2 || f3)big = true;
    //////
    if(big){
        if(f1){
            bby = 2;
        }
        else if(f2) bby = 0;
        else bby = -2;
    }
    else{
        cur = org;
        cur.first += 2*m;
        if(in(cur,n)){
            if(query(cur,n))bby = 1;
        }
        else{
            bby = -1;
        }
    }
    cout<<"f1 "<<f1<<endl;
    cout<<"f2 "<<f2<<endl;
    cout<<"f3 "<<f3<<endl;

    /////
    cur = org;
    //cur.second += 2*m;
    big = false;
    //determine if he is in the big ahh row
    f1 = false;
    f2 = false;
    f3 = false;
    cur.second += 4*m;
    if(in(cur,n)){
        
        if(query(cur,n))f1 = true;
    }
    cur.second -= 8*m;
    if(in(cur,n))if(query(cur,n))f3 = true;
    cur.second += 2*m;
    if(in(cur,n)){
        if(query(cur,n)){
        cur.second += 4*m;
        if(in(cur,n)){
            if(query(cur,n))f2 = true;
        }
        }
    }
    if(f1 || f2 || f3)big = true;
    //////
    if(big){
        if(f1){
            r = 2;
        }
        else if(f2) r = 0;
        else r = -2;
    }
    else{
        cur = org;
        cur.second += 2*m;
        if(in(cur,n)){
            if(query(cur,n))r = 1;
        }
        else{
            r = -1;
        }
    }
    
    cout<<"R "<<r<<endl;
    cout<<"BBY "<<bby<<endl;
    cout<<"solution "<<org.first + (bby)*m<<" "<<org.second + (r)*m<<endl;
    cout.flush();
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;//cin>>t;
    t = 1;
    while(t--){
        solve();
    }
}
#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...