Submission #466251

# Submission time Handle Problem Language Result Execution time Memory
466251 2021-08-18T12:13:14 Z FatihSolak Aliens (IOI07_aliens) C++17
0 / 100
2 ms 456 KB
#include <bits/stdc++.h>
#define N 200005
#define int long long
using namespace std;
int n;
bool ask(int pos1,int pos2){
    if(min(pos1,pos2) < 1 || max(pos1,pos2) > n)return 0;
    cout << "examine " << pos1 << " " << pos2 << endl;
    string s;
    cin >> s;
    return s == "true";
}
pair<int,int> lift(int pos1,int pos2,int m,int dir1,int dir2){
    for(int i=30;i>=0;i--){
        if((1<<i) <= m && ask(pos1 + dir1*(1<<i),pos2 + dir2*(1<<i))){
            pos1 += dir1*(1<<i);
            pos2 += dir2*(1<<i);
            m    -= (1<<i);
        }
    }
    return {pos1,pos2};
}
void solve(){
    int x,y;
    cin >> n >> x >> y;
    int m = -1;
    int posx = -1,posy = -1;
    int l = lift(x,y,2e9,-1,0).first, r = lift(x,y,2e9,1,0).first;
    for(int i = 0;i<3;i++){
        for(int j = 0;j<3;j++){
            if( (i + j) > 2 || (r - l + 1)%((i+j)*2 + 1))continue;
            int tmp = (r - l + 1)/((i+j)*2 + 1);
            posx = l + 2*i*tmp;
            if(lift(l,r,tmp,-1,0).first != posx)continue;
            if(m != -1)assert(0);
            m = tmp;
        }
    }
    if(m == -1)assert(0);
    posy = lift(l,r,m,0,-1).second;
    for(int i=0;i<2;i++){
        if(ask(posx - m*i*2,posy))posx -= m*i*2;
        if(ask(posx ,posy - m*i*2))posy -= m*i*2;
    }
    posx += 2*m + m/2;
    posy += 2*m + m/2;
    cout << "solution " << posx << ""  << posy << endl;
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    #ifdef Local
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    #ifdef Local
    cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 200 KB Expected int32, but "30258363045834" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 436 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -