답안 #521668

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
521668 2022-02-02T17:49:58 Z perchuts Aliens (IOI07_aliens) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define maxn (int)(1e5+51)
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define ll long long
#define pb push_back
#define ull unsigned long long
#define ii pair<int,int>
#define iii tuple<int,int,int>
#define inf 2000000001
#define mod 1000000007 //998244353
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

template<typename X, typename Y> bool ckmin(X& x, const Y& y) { return (y < x) ? (x=y,1):0; }
template<typename X, typename Y> bool ckmax(X& x, const Y& y) { return (x < y) ? (x=y,1):0; }
int q = 0;

bool query(ll x,ll y){
    q++;
    cout<<"examine "<<x<<" "<<y<<endl;
    string s;cin>>s;
    if(q==300)tle();
    return s=="true";
}

void tle(){
    while(true){
        cout<<"a"<<endl;
    }
}

int main(){_
    ll n,x0,y0;cin>>n>>x0>>y0;
    ll l,r,leftmost = x0,rightmost = x0,topmost = y0;
    bool ok = true;
    while(ok){
        ok = false;
        l = 1, r = leftmost-1LL;
        while(l<=r){
        ll md = l + (r-l+1LL)/2;
        if(query(md,y0)){
            leftmost = md;
            r = md-1LL;
            ok = true;
        }else{
            l = md+1LL;
        }   
    }
    }
    //rightmost
    ok = true;
    while(ok){
        ok = false;
        l = rightmost + 1LL, r = n;
        while(l<=r){
            ll md = l + (r-l+1LL)/2;
            if(query(md,y0)){
                rightmost = md;
                l = md+1LL;
                ok = true;
            }else r = md-1LL;
        }
    }
    //topmost
    ok = true;
    while(ok){
        l = topmost+1LL, r = n;
        ok = false;
        while(l<=r){
        ll md = l + (r-l+1)/2;
        if(query(x0,md)){
            topmost = md;
            l = md+1LL;
            ok = true;
        }else r = md-1LL;
        
        }
    }
    ll len = rightmost - leftmost + 1;
    ll xc = leftmost + len/2, yc = topmost - len/2;
    cout<<"solution "<<xc<<" "<<yc<<endl;
}

Compilation message

aliens.cpp: In function 'bool query(long long int, long long int)':
aliens.cpp:24:15: error: 'tle' was not declared in this scope
   24 |     if(q==300)tle();
      |               ^~~