Submission #1027494

#TimeUsernameProblemLanguageResultExecution timeMemory
1027494KasymKGap (APIO16_gap)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" using namespace std; #define pb push_back #define all(v) v.begin(), v.end() #define ll long long ll findGap(int t, int n){ if(t == 1){ ll l = 1, r = 1e18, id = 0, mn, mx; vector<ll> a; a.resize(n+5); for(int i = 0; i < (n+1)>>1; ++i){ MinMax(l, r, &mn, &mx); a[id++] = mn; a[id++] = mx; l = mn+1, r = mx-1; } sort(all(a)); int answer = 0; for(int i = 0; i < n-1; ++i) answer = max(answer, a[i+1]-a[i]); return answer; } }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:13:13: error: 'MinMax' was not declared in this scope
   13 |             MinMax(l, r, &mn, &mx);
      |             ^~~~~~
gap.cpp:21:45: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   21 |             answer = max(answer, a[i+1]-a[i]);
      |                                             ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from gap.cpp:1:
/usr/include/c++/10/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++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
gap.cpp:21:45: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
   21 |             answer = max(answer, a[i+1]-a[i]);
      |                                             ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from gap.cpp:1:
/usr/include/c++/10/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++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
gap.cpp:21:45: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
   21 |             answer = max(answer, a[i+1]-a[i]);
      |                                             ^
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:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
gap.cpp:21:45: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   21 |             answer = max(answer, a[i+1]-a[i]);
      |                                             ^
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: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
gap.cpp:21:45: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   21 |             answer = max(answer, a[i+1]-a[i]);
      |                                             ^
gap.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^