Submission #1029908

#TimeUsernameProblemLanguageResultExecution timeMemory
1029908KasymKGap (APIO16_gap)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" #include "gap.h" using namespace std; #define ff first #define ss second #define all(v) v.begin(), v.end() #define ll long long #define pb push_back #define pii pair<int, int> template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} const int MOD = 1e9+7; const int N = 1e5+5; const ll INF = 1e18; ll a[N]; ll findGap(int t, int n){ if(t == 1){ ll l = 0, r = INF, id = 0, mn, mx, ans = 0; for(int i = 0; i < (n+1)/2; ++i){ MinMax(l, r, &mn, &mx); a[id++] = mn; a[id++] = mx; l = mn+1, r = mx-1; } sort(a, a+n); for(int i = 0; i < n-1; ++i) umin(ans, a[i+1]-a[i]); return ans; } int a_, b_, mn, mx, id = 0; MinMax(0ll, INF, &mn, &mx); ll d = (mx-mn-1)/(n-1); a[id++] = mn; for(ll l = mn+1; l < mx; l+=d+1){ MinMax(l, min(l+d, mx-1), &a_, &b_); if(a_ != -1) a[id++] = a_, a[id++] = b_; } a[id++] = mx; ll ans = 0; for(int i = 0; i < n-1; ++i) umin(ans, a[i+1]-a[i]); return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:32:19: error: cannot convert 'int*' to 'long long int*'
   32 |  MinMax(0ll, INF, &mn, &mx);
      |                   ^~~
      |                   |
      |                   int*
In file included from gap.cpp:2:
gap.h:1:35: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                   ^~~~~~~~~~
gap.cpp:36:26: error: no matching function for call to 'min(long long int, int)'
   36 |   MinMax(l, min(l+d, mx-1), &a_, &b_);
      |                          ^
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:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
gap.cpp:36:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   36 |   MinMax(l, min(l+d, mx-1), &a_, &b_);
      |                          ^
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:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
gap.cpp:36:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   36 |   MinMax(l, min(l+d, mx-1), &a_, &b_);
      |                          ^
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:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
gap.cpp:36:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   36 |   MinMax(l, min(l+d, mx-1), &a_, &b_);
      |                          ^
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:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
gap.cpp:36:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   36 |   MinMax(l, min(l+d, mx-1), &a_, &b_);
      |                          ^