Submission #1232328

#TimeUsernameProblemLanguageResultExecution timeMemory
1232328marselelGap (APIO16_gap)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; # define all(a) a.begin(), a.end() # define rall(a) a.rbegin(), a.rend() # define pii pair<int, int> # define pll pair<ll, ll> #ifdef LOCAL #include "algo/debug.h" #else # define debug(x) #endif constexpr int inf = 0x3f3f3f3f; constexpr ll INF = 2e15; const ld RANDMAX = (1LL << 32) - 1; const ll mod = 1'000'000'007; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int findGap(int T, int N) { if (T == 2)return -1; set<int> st; ll s = -1, t = 2e18; ll mn = 0, mx = 0; while (mn <= mx) { MinMax(s, t, mn, mx); if (mn == -1 && mx == -1) { break; } st.insert(mn); st.insert(mx); s = mn + 1; t = mx - 1; } vector<int> a; for (auto v : st) { a.push_back(v); } ll ans = 0; for (int i = 1; i < (int)a.size(); ++i) { ans = max(ans, a[i] - a[i - 1]); } return ans; }

Compilation message (stderr)

gap.cpp: In function 'int findGap(int, int)':
gap.cpp:32:9: error: 'MinMax' was not declared in this scope
   32 |         MinMax(s, t, mn, mx);
      |         ^~~~~~
gap.cpp:47:18: error: no matching function for call to 'max(ll&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)'
   47 |         ans = max(ans, a[i] - a[i - 1]);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from gap.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
gap.cpp:47:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   47 |         ans = max(ans, a[i] - a[i - 1]);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from gap.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
gap.cpp:47:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   47 |         ans = max(ans, a[i] - a[i - 1]);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from gap.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3461 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3461:5: note:   template argument deduction/substitution failed:
gap.cpp:47:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   47 |         ans = max(ans, a[i] - a[i - 1]);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from gap.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3467:5: note:   template argument deduction/substitution failed:
gap.cpp:47:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   47 |         ans = max(ans, a[i] - a[i - 1]);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~