| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 522595 | cig32 | Boxes with souvenirs (IOI15_boxes) | C++17 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#include "boxes.h"
#define int long long
long long delivery(int32_t n, int32_t k, int32_t l, int32_t p[]) {
int L[n+1], R[n+1], ans = 1e18;
for(int i=0; i<=n; i++) L[i] = R[i] = 1e18;
L[0] = R[n] = 0;
for(int i=1; i<=n; i++) {
L[i] = L[max(i-k, 0ll)] + 2 * p[i-1],
R[n-i] = R[min(n-i+k, n)] - 2 * p[n-i] + 2 * l;
}
for(int i=0; i<=n; i++) ans = min(ans, L[i] + min(R[i], R[min(i+k, n)] + 1));
return ans;
}
Compilation message (stderr)
boxes.cpp: In function 'long long int delivery(int32_t, int32_t, int32_t, int32_t*)':
boxes.cpp:11:28: error: no matching function for call to 'min(long long int, int32_t&)'
11 | R[n-i] = R[min(n-i+k, n)] - 2 * p[n-i] + 2 * l;
| ^
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 boxes.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:
boxes.cpp:11:28: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int32_t' {aka 'int'})
11 | R[n-i] = R[min(n-i+k, n)] - 2 * p[n-i] + 2 * l;
| ^
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 boxes.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:
boxes.cpp:11:28: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int32_t' {aka 'int'})
11 | R[n-i] = R[min(n-i+k, n)] - 2 * p[n-i] + 2 * 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: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:
boxes.cpp:11:28: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
11 | R[n-i] = R[min(n-i+k, n)] - 2 * p[n-i] + 2 * 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: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:
boxes.cpp:11:28: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
11 | R[n-i] = R[min(n-i+k, n)] - 2 * p[n-i] + 2 * l;
| ^
boxes.cpp:13:71: error: no matching function for call to 'min(long long int, int32_t&)'
13 | for(int i=0; i<=n; i++) ans = min(ans, L[i] + min(R[i], R[min(i+k, n)] + 1));
| ^
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 boxes.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:
boxes.cpp:13:71: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int32_t' {aka 'int'})
13 | for(int i=0; i<=n; i++) ans = min(ans, L[i] + min(R[i], R[min(i+k, n)] + 1));
| ^
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 boxes.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:
boxes.cpp:13:71: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int32_t' {aka 'int'})
13 | for(int i=0; i<=n; i++) ans = min(ans, L[i] + min(R[i], R[min(i+k, n)] + 1));
| ^
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: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:
boxes.cpp:13:71: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
13 | for(int i=0; i<=n; i++) ans = min(ans, L[i] + min(R[i], R[min(i+k, n)] + 1));
| ^
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: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:
boxes.cpp:13:71: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
13 | for(int i=0; i<=n; i++) ans = min(ans, L[i] + min(R[i], R[min(i+k, n)] + 1));
| ^