답안 #436815

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
436815 2021-06-25T01:39:59 Z definitelynotmee Aliens (IOI07_aliens) C++
90 / 100
3 ms 256 KB
#include <bits/stdc++.h>
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INFL = (1LL<<62)-1;
const int INF = (1<<30)-1;
const int MOD = 1e9 + 7;
const int MAXN = 1e6+1;

int counter = 0;

bool check(){
    counter++;
    string s;
    cin >> s;
    if(s[0] == 't')
        return true;
    return false;
}

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, x, y;
    cin >> n >> x >> y;
    function<ll(ll,ll)> bs1 = [&](ll ini, ll fim){
        while(ini != fim){
            ll m = (ini+fim)>>1;
            cout << "examine " << m << ' ' << y << endl;
            if(check()){
                fim = m;
            } else ini = m+1;
        }
        cout << "examine " << ((ini + x)>>1) << ' ' << y << endl;
        if(!check())
            return bs1(((ini + x)>>1), x);
        
        cout << "examine " << ((((ini + x)>>1)+x)>>1) << ' ' << y << endl;
        if(!check())
            return bs1(((((ini + x)>>1)+x)>>1), x);
        return ini;
    };

    function<ll(ll,ll)> bs2 = [&](ll ini, ll fim){
        while(ini != fim){
            ll m = (ini+fim+1)>>1;
            cout << "examine " << m << ' ' << y << endl;
            if(check()){
                ini = m;
            } else fim = m-1;
        }
        cout << "examine " << ((ini + x)>>1) << ' ' << y << endl;
        if(!check())
            return bs2(x,((ini + x)>>1));
        
        cout << "examine " << ((((ini + x)>>1)+x)>>1) << ' ' << y << endl;
        if(!check())
            return bs2(x,((((ini + x)>>1)+x)>>1));
        return ini;
    };
    function<ll(ll,ll)> bs3 = [&](ll ini, ll fim){
        while(ini != fim){
            ll m = (ini+fim)>>1;
            cout << "examine " << x << ' ' << m << endl;
            if(check()){
                fim = m;
            } else ini = m+1;
        }
        return ini;
    };
    int x1 = bs1(1,x);
    int x2 = bs2(x,n);
    const int resp = x2-x1+1;
    int y1 = bs3(max(1LL,y-resp),y);
    
    while(true){
        x1-=2*resp;
        if(x1 > 0){
            cout << "examine " << x1 << ' ' << y1 << endl;
            if(check())
                continue;
        }
        x1+=2*resp;
        break;
    }
    while(true){
        y1-=2*resp;
        if(y1 > 0){
            cout << "examine " << x1 << ' ' << y1 << endl;
            if(check())
                continue;
        }
        y1+=2*resp;
        break;
    }
    if(x1 > 1 && y1 > 1){
        cout << "examine " << x1-1 << ' ' << y1-1 << endl;
        if(check())
            x1-=resp, y1-=resp;
        
    }
    if(counter >145)
        exit(1);
    cout << "solution " << x1 + 2*resp + resp/2 << ' ' << y1 + 2*resp + resp/2 << endl;
    return 0;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 200 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 3 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 3 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Runtime error 3 ms 200 KB Execution failed because the return code was nonzero
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 2 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
3 Correct 2 ms 200 KB Output is correct