Submission #330682

#TimeUsernameProblemLanguageResultExecution timeMemory
330682monkey8Boxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include "boxes.h" #include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> #include <cstdio> #include <utility> #include <queue> #include <math.h> #include <set> #include <bitset> #include <cmath> #include <bitset> #include <stack> #include <cstring> #include <deque> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int MAXN = 10000010; ll pre1[MAXN]; ll pre2[MAXN]; ll delivery(int n, int k, int l, int p[]) { l = (ll)l; for(int i = 0; i < n; i++) { if(i < k) pre1[i] = (ll)2 * (ll)p[i]; else pre1[i] = (ll)2 * (ll)p[i] + pre1[i - k]; } for(int i = n - 1; i >= 0; i--) { if(i > n - 1 - k) pre2[i] = (ll)2 * (l - (ll)p[i]); else pre2[i] = (ll)2 * (l - (ll)p[i]) + pre2[i - k]; } ll ans = min(pre1[n - 1], pre2[0]); for(int i = 0; i < n - 1; i++) ans = min(ans, pre1[i] + pre2[i + 1]); if(n == k) return min(ans, l); ans = min(ans, min(pre1[n - k - 1] + l, pre2[k] + l)); for(int i = 0; i < n - k - 1; i++) ans = min(ans, pre1[i] + l + pre2[i + k + 1]); return ans; }

Compilation message (stderr)

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:37:33: error: no matching function for call to 'min(ll&, int&)'
   37 |     if(n == k) return min(ans, l);
      |                                 ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/ostream:38,
                 from /usr/include/c++/9/iostream:39,
                 from boxes.cpp:2:
/usr/include/c++/9/bits/stl_algobase.h:198:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  198 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:198:5: note:   template argument deduction/substitution failed:
boxes.cpp:37:33: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   37 |     if(n == k) return min(ans, l);
      |                                 ^
In file included from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/ostream:38,
                 from /usr/include/c++/9/iostream:39,
                 from boxes.cpp:2:
/usr/include/c++/9/bits/stl_algobase.h:246:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  246 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:246:5: note:   template argument deduction/substitution failed:
boxes.cpp:37:33: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   37 |     if(n == k) return min(ans, l);
      |                                 ^
In file included from /usr/include/c++/9/algorithm:62,
                 from boxes.cpp:4:
/usr/include/c++/9/bits/stl_algo.h:3444:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3444 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3444:5: note:   template argument deduction/substitution failed:
boxes.cpp:37:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   37 |     if(n == k) return min(ans, l);
      |                                 ^
In file included from /usr/include/c++/9/algorithm:62,
                 from boxes.cpp:4:
/usr/include/c++/9/bits/stl_algo.h:3450:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3450 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
boxes.cpp:37:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   37 |     if(n == k) return min(ans, l);
      |                                 ^