답안 #441554

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
441554 2021-07-05T11:08:52 Z jeroenodb Snake (CEOI08_snake) C++14
컴파일 오류
0 ms 0 KB
/*
ID: jeroen.3
TASK: snake
LANG: C++            
*/
#include "snakelib.h"
#include "bits/stdc++.h"
using namespace std;
#define all(x) x.begin(),x.end()
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { string sep; for (const T &x : v) os << sep << x, sep = " "; return os; }
#define debug(a) cerr << "(" << #a << ": " << a << ")\n";
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pi;

const int L=12122, oo = 1e9;
int l=0,r=L-1, a=0,b=L-1,k;
void update() {
    r=min(r+k,L-1),b=min(b+k,L-1);
}
void handle(int i, char c) {
    if(c=='b') {
        l=max(l,i+1);
        a=max(a,i+2);
    } else if(c=='s') {
        r=min(r,i);
        a=max(a,i+1);
    } else if(c=='f') {
        r=min(r,i-1);
        b=min(b,i);
    }
}
void myask(int i, int j) {
    char q1,q2;
    ask_snake(i,j,&q1,&q2);
    handle(i,q1);
    handle(j,q2);
}
bool good() {
    return b-l - max(0,a-l) <=2*k;
}
int main() {
    // #ifndef LOCAL
    // freopen("snake.in", "r", stdin);
    // freopen("snake.out", "w", stdout);
    // #endif
    k=get_speed();
    myask(L/3, 2*L/3);
    while(!good()) {
        update();
        ask((l+r+1)/2, (a+b)/2);
    }
    tell_length((b-l+a-r)/2);
}

Compilation message

snake.cpp: In function 'int main()':
snake.cpp:53:9: error: 'ask' was not declared in this scope; did you mean 'myask'?
   53 |         ask((l+r+1)/2, (a+b)/2);
      |         ^~~
      |         myask