Submission #493529

#TimeUsernameProblemLanguageResultExecution timeMemory
493529Leo121Rice Hub (IOI11_ricehub)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "ricehub.h" typedef long long ll; int besthub(int R, int L, int X[], long long B) { int li = 0, ls = 0, mediana, res = 1, nueva_mediana; ll inversion = 0LL; while(ls < R - 1){ ls ++; mediana = (li + ls) / 2; inversion += ((ll) X[ls] - (ll) X[mediana]); if(inversion <= B){ res = max(res, ls - li + 1); continue; } while(inversion > B){ inversion -= ((ll) X[mediana] - (ll) X[li]); nueva_mediana = (li + ls + 1) / 2; if(mediana != (li + ls + 1) / 2){ inversion -= ((ll) X[nueva_mediana] - (ll) X[mediana]); } li ++; mediana = nueva_mediana; } } return res; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:13:19: error: 'max' was not declared in this scope; did you mean 'std::max'?
   13 |             res = max(res, ls - li + 1);
      |                   ^~~
      |                   std::max
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from ricehub.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~