Submission #23516

#TimeUsernameProblemLanguageResultExecution timeMemory
23516NirjhorGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" #include <algorithm> typedef long long ll; ll findGap (int subTask, int n) { ll l, r, ret = 0; MinMax(0, 1e18, &l, &r); if (subTask == 1) { for (int i = 0; l < r; ++i) { ll new_l, new_r; MinMax(l + 1, r - 1, &new_l, &new_r); ret = max(ret, new_l - l); ret = max(ret, r - new_r); l = new_l, r = new_r; } } else { ll block = (r - l + n - 3)/(n - 1); for (ll i = l + 1, j = i + block; i < r; i += block, j += block) { ll new_l, new_r; if (j > r) j = r; MinMax(i, j - 1, &new_l, &new_r); if (new_l != -1) { ret = max(ret, new_l - l); l = new_r; } } ret = max(ret, r - l); } return ret; }

Compilation message (stderr)

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:13:31: error: 'max' was not declared in this scope
       ret = max(ret, new_l - l);
                               ^
gap.cpp:13:31: note: suggested alternative:
In file included from /usr/include/c++/5/algorithm:62:0,
                 from gap.cpp:2:
/usr/include/c++/5/bits/stl_algo.h:3463:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^
gap.cpp:24:33: error: 'max' was not declared in this scope
         ret = max(ret, new_l - l);
                                 ^
gap.cpp:24:33: note: suggested alternative:
In file included from /usr/include/c++/5/algorithm:62:0,
                 from gap.cpp:2:
/usr/include/c++/5/bits/stl_algo.h:3463:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^
gap.cpp:28:25: error: 'max' was not declared in this scope
     ret = max(ret, r - l);
                         ^
gap.cpp:28:25: note: suggested alternative:
In file included from /usr/include/c++/5/algorithm:62:0,
                 from gap.cpp:2:
/usr/include/c++/5/bits/stl_algo.h:3463:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^