Submission #672012

#TimeUsernameProblemLanguageResultExecution timeMemory
672012Hacv16Rice Hub (IOI11_ricehub)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "ricehub.h" using namespace std; typedef long long ll; const int INF = 0x3f3f3f3f; int besthub(int n, int l, int x[], ll b){ int ans = 0; for(int mid = 0; mid < n; mid++){ ll cnt = 1, l = mid - 1, r = mid + 1, av = b; while(b && (l >= 0 || r < n)){ int dl = (l >= 0 ? x[mid] - x[l] : INF); int dr = (r < n ? x[r] - x[mid] : INF); if(av - min(dl, dr) < 0) break; av -= min(dl, dr); if(dl < dr) l--; else r++; cnt++; } ans = max(ans, cnt); } return ans; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, ll)':
ricehub.cpp:28:23: error: no matching function for call to 'max(int&, ll&)'
   28 |     ans = max(ans, cnt);
      |                       ^
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 ricehub.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:
ricehub.cpp:28:23: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   28 |     ans = max(ans, cnt);
      |                       ^
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 ricehub.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:
ricehub.cpp:28:23: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   28 |     ans = max(ans, cnt);
      |                       ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from ricehub.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:
ricehub.cpp:28:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   28 |     ans = max(ans, cnt);
      |                       ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from ricehub.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:
ricehub.cpp:28:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   28 |     ans = max(ans, cnt);
      |                       ^