Submission #40764

#TimeUsernameProblemLanguageResultExecution timeMemory
40764ssnsarang2023Gap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> typedef long long ll; ll findGap(int _t, int _n) { ll n = _n; ll mn = 1, mx = (ll)1e18; MinMax(mn, mx, &mn, &mx); ll d = (mx - mn) / n, mod = (mx - mn) % n, pre = mn; ll pstep = mn, step = mn + d + - 1 + mod, gap = 0; while (1) { ll mntmp = -1, mxtmp = -1; if (pstep <= min(mx - 1, step)) MinMax(pstep + 1, min(mx - 1, step), &mntmp, &mxtmp); if (step >= mx) { if (mxtmp != -1) gap = max(gap, mx - mxtmp); else gap = max(gap, mx - pre); } else if (mntmp != -1) gap = max(gap, mntmp - pre); pre = mxtmp, pstep = step, step += d; } return gap; }

Compilation message (stderr)

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:8:25: error: 'MinMax' was not declared in this scope
  MinMax(mn, mx, &mn, &mx);
                         ^
gap.cpp:13:32: error: 'min' was not declared in this scope
   if (pstep <= min(mx - 1, step)) MinMax(pstep + 1, min(mx - 1, step), &mntmp, &mxtmp);
                                ^
gap.cpp:13:32: note: suggested alternative:
In file included from /usr/include/c++/5/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from gap.cpp:1:
/usr/include/c++/5/bits/stl_algo.h:3451:5: note:   'std::min'
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^
gap.cpp:15:46: error: 'max' was not declared in this scope
    if (mxtmp != -1) gap = max(gap, mx - mxtmp);
                                              ^
gap.cpp:15:46: note: suggested alternative:
In file included from /usr/include/c++/5/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from gap.cpp:1:
/usr/include/c++/5/bits/stl_algo.h:3463:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^
gap.cpp:16:32: error: 'max' was not declared in this scope
    else gap = max(gap, mx - pre);
                                ^
gap.cpp:16:32: note: suggested alternative:
In file included from /usr/include/c++/5/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from gap.cpp:1:
/usr/include/c++/5/bits/stl_algo.h:3463:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^
gap.cpp:17:53: error: 'max' was not declared in this scope
   } else if (mntmp != -1) gap = max(gap, mntmp - pre);
                                                     ^
gap.cpp:17:53: note: suggested alternative:
In file included from /usr/include/c++/5/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from gap.cpp:1:
/usr/include/c++/5/bits/stl_algo.h:3463:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^