Submission #500829

# Submission time Handle Problem Language Result Execution time Memory
500829 2022-01-01T10:49:43 Z beaconmc Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
typedef long long ll;
using namespace std;

 
int besthub(int R,int L,int X[],ll B){
    ll lo=0,hi=0,ans=1,curcost=0;
    while (hi<R){
        if ((hi-lo)%2==0 && hi!=lo) curcost += X[hi] - X[(hi-lo-1)/2+1 + lo];
        else curcost += X[hi] - X[(hi-lo-1)/2 + lo];
        if (curcost>B){
            if ((hi-lo)%2==0) curcost += X[lo] -X[hi];
            else curcost += X[lo] - X[hi];
            lo ++;
        } else hi++;
        ans = max(ans, hi-lo);
    }
    return ans;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, ll)':
ricehub.cpp:15:15: error: 'max' was not declared in this scope
   15 |         ans = max(ans, hi-lo);
      |               ^~~