Submission #636876

#TimeUsernameProblemLanguageResultExecution timeMemory
636876lovrotGap (APIO16_gap)C++11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "gap.h" #define X first #define Y second #define ll long long const int N = 100010; const ll INF = 1e18; ll niz[N]; ll findGap(int t, int n){ if(t == 1){ int minp = 0; int maxp = n - 1; ll mn = 0, minr; ll mx = INF, maxr; while(minp <= maxp){ MinMax(mn, mx, &minr, &maxr); niz[minp] = minr; niz[maxp] = maxr; mn = minr + 1; mx = maxr - 1; minp++; maxp--; } ll ans = 0; for(int i = 0; i < n - 1; i++) ans = max(ans, niz[i + 1] - niz[i]); return ans; } ll mn = 0; ll mx = INF; MinMax(mn, mx, &mn, &mx); niz[n - 1] = mx; niz[0] = mn; for(int i = n - 2; i > 0; i--){ mx--; mn = mx; MinMax(mn, mx, &mn, &mx); niz[i] = mx; } ll ans = 0; for(int i = 0; i < n - 1; i++) ans = max(ans, niz[i + 1] - niz[i]); return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:31:40: error: 'max' was not declared in this scope; did you mean 'std::max'?
   31 |   for(int i = 0; i < n - 1; i++) ans = max(ans, niz[i + 1] - niz[i]);
      |                                        ^~~
      |                                        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 gap.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)
      |     ^~~
gap.cpp:48:39: error: 'max' was not declared in this scope; did you mean 'std::max'?
   48 |  for(int i = 0; i < n - 1; i++) ans = max(ans, niz[i + 1] - niz[i]);
      |                                       ^~~
      |                                       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 gap.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)
      |     ^~~