답안 #1003100

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1003100 2024-06-20T06:07:17 Z vjudge1 쌀 창고 (IOI11_ricehub) C++17
컴파일 오류
0 ms 0 KB
int besthub(int n, int last, int x[], ll b){
    

    int ans = 0;
    int l , r;
    for(int i = 0; i < n; i++){
        
        l = i - (lower_bound(x, x + n, max(0LL,x[i]-b))- x);
        r =  (upper_bound(x, x +n, min((ll) last, x[i]+b)) -x) - (i+1);
       // cout << x[i] << " " <<l << " " << r << endl;
        ans = max(l+r+1,ans);
    }
    
    return ans;

}

Compilation message

ricehub.cpp:1:39: error: 'll' has not been declared
    1 | int besthub(int n, int last, int x[], ll b){
      |                                       ^~
ricehub.cpp: In function 'int besthub(int, int, int*, int)':
ricehub.cpp:8:40: error: 'max' was not declared in this scope
    8 |         l = i - (lower_bound(x, x + n, max(0LL,x[i]-b))- x);
      |                                        ^~~
ricehub.cpp:8:18: error: 'lower_bound' was not declared in this scope
    8 |         l = i - (lower_bound(x, x + n, max(0LL,x[i]-b))- x);
      |                  ^~~~~~~~~~~
ricehub.cpp:9:41: error: 'll' was not declared in this scope; did you mean 'l'?
    9 |         r =  (upper_bound(x, x +n, min((ll) last, x[i]+b)) -x) - (i+1);
      |                                         ^~
      |                                         l
ricehub.cpp:9:36: error: 'min' was not declared in this scope
    9 |         r =  (upper_bound(x, x +n, min((ll) last, x[i]+b)) -x) - (i+1);
      |                                    ^~~
ricehub.cpp:9:15: error: 'upper_bound' was not declared in this scope
    9 |         r =  (upper_bound(x, x +n, min((ll) last, x[i]+b)) -x) - (i+1);
      |               ^~~~~~~~~~~