Submission #500827

# Submission time Handle Problem Language Result Execution time Memory
500827 2022-01-01T10:48:15 Z beaconmc Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
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:230: error: 'max' was not declared in this scope
    1 | 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;}
      |                                                                                                                                                                                                                                      ^~~