Submission #500828

# Submission time Handle Problem Language Result Execution time Memory
500828 2022-01-01T10:48:50 Z beaconmc Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
using namespace std;typedef long long ll;int besthub(int R,int L,int X[],ll B){ll l=0,h=0,a=1,c=0,z;while(h<R){z=h-l;if(z%2==0 && h!=l)c+=X[h]-X[(z-1)/2+1+l];else c+=X[h]-X[(z-1)/2+l];if(c>B){if(z%2==0)c+=X[l]-X[h];else c+=X[l]-X[h];l++;}else h++;a=max(a, h-l);}return a;}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, ll)':
ricehub.cpp:1:250: error: 'max' was not declared in this scope
    1 | using namespace std;typedef long long ll;int besthub(int R,int L,int X[],ll B){ll l=0,h=0,a=1,c=0,z;while(h<R){z=h-l;if(z%2==0 && h!=l)c+=X[h]-X[(z-1)/2+1+l];else c+=X[h]-X[(z-1)/2+l];if(c>B){if(z%2==0)c+=X[l]-X[h];else c+=X[l]-X[h];l++;}else h++;a=max(a, h-l);}return a;}
      |                                                                                                                                                                                                                                                          ^~~