Submission #652415

#TimeUsernameProblemLanguageResultExecution timeMemory
652415jiahngBoxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll typedef pair<int,int> pi; typedef vector <int> vi; typedef vector <pi> vpi; typedef pair<pi, ll> pii; typedef set <ll> si; typedef long double ld; #define f first #define s second #define mp make_pair #define FOR(i,s,e) for(int i=s;i<=int(e);++i) #define DEC(i,s,e) for(int i=s;i>=int(e);--i) #define pb push_back #define all(x) (x).begin(), (x).end() #define lbd(x, y) lower_bound(all(x), y) #define ubd(x, y) upper_bound(all(x), y) #define aFOR(i,x) for (auto i: x) #define mem(x,i) memset(x,i,sizeof x) #define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0) #define maxn 10000010 #define INF (ll)1e9 #define MOD 1000000007 typedef pair <vi, int> pvi; typedef pair <int,pi> ipi; typedef vector <pii> vpii; int pre[maxn], post[maxn]; long long delivery(int32_t N, int32_t K, int32_t L, int32_t p[]) { int cur = 0; FOR(i,0,N-1){ pre[i] = cur + 2*p[i]; if ((i+1) % K == 0) cur += 2*p[i]; } cur = 0; DEC(i,N-1,0){ post[i] = cur + 2*(L-p[i]); if ((N-i) % K == 0) cur += 2*(L-p[i]); } //FOR(i,0,N-1){ //cout << pre[i] << ' ' << post[i] << '\n'; //} int ans = min(pre[N-1], post[0]); ans = min(ans, ((N + K - 1) / K) * L); FOR(i,0,N-1){ ans = min(ans, pre[i] + ((N - i - 1 + K - 1) / K) * L); ans = min(ans, post[i] + ((i + K - 1) / K) * L); } FOR(i,0,N-2) FOR(j,i+1,N-1){ ans = min(ans, pre[i] + post[j] + ((j - i - 1 + K - 1) / K) * L); } //ans = min(ans, (pre[i] + post[i+1])); return ans; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int32_t, int32_t, int32_t, int32_t*)':
boxes.cpp:50:41: error: no matching function for call to 'min(ll&, int32_t)'
   50 |     ans = min(ans, ((N + K - 1) / K) * L);
      |                                         ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from boxes.cpp:2:
/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:
boxes.cpp:50:41: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int32_t' {aka 'int'})
   50 |     ans = min(ans, ((N + K - 1) / K) * L);
      |                                         ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from boxes.cpp:2:
/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:
boxes.cpp:50:41: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int32_t' {aka 'int'})
   50 |     ans = min(ans, ((N + K - 1) / K) * L);
      |                                         ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from boxes.cpp:2:
/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:
boxes.cpp:50:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   50 |     ans = min(ans, ((N + K - 1) / K) * L);
      |                                         ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from boxes.cpp:2:
/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:
boxes.cpp:50:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   50 |     ans = min(ans, ((N + K - 1) / K) * L);
      |                                         ^