| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 642058 | QwertyPi | 선물상자 (IOI15_boxes) | C++14 | 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 "boxes.h"
#include <bits/stdc++.h>
using namespace std;
long long dp_l[10000001];
long long dp_r[10000001];
long long delivery(int N, int K, int L, int p[]) {
for(int i = 0; i < N; i++){
dp_l[i + 1] = dp_l[max(0LL, i + 1 - K)] + min(L, p[i] * 2);
}
for(int i = N; i >= 1; i--){
dp_r[i] = dp_r[min(N + 1, i + K)] + min(L, (L - p[i - 1]) * 2);
}
int ans = 1LL << 60;
for(int l = 0; l <= N; l++){
ans = min(ans, dp_l[l] + dp_r[l + 1]);
}
return ans;
}
Compilation message (stderr)
boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:12:40: error: no matching function for call to 'max(long long int, int)'
12 | dp_l[i + 1] = dp_l[max(0LL, i + 1 - K)] + min(L, p[i] * 2);
| ^
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:3:
/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:
boxes.cpp:12:40: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
12 | dp_l[i + 1] = dp_l[max(0LL, i + 1 - K)] + min(L, p[i] * 2);
| ^
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:3:
/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:
boxes.cpp:12:40: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
12 | dp_l[i + 1] = dp_l[max(0LL, i + 1 - K)] + min(L, p[i] * 2);
| ^
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:3:
/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:
boxes.cpp:12:40: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
12 | dp_l[i + 1] = dp_l[max(0LL, i + 1 - K)] + min(L, p[i] * 2);
| ^
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:3:
/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:
boxes.cpp:12:40: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
12 | dp_l[i + 1] = dp_l[max(0LL, i + 1 - K)] + min(L, p[i] * 2);
| ^
boxes.cpp:17:16: warning: overflow in conversion from 'long long int' to 'int' changes value from '1152921504606846976' to '0' [-Woverflow]
17 | int ans = 1LL << 60;
| ~~~~^~~~~
boxes.cpp:19:39: error: no matching function for call to 'min(int&, long long int)'
19 | ans = min(ans, dp_l[l] + dp_r[l + 1]);
| ^
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:3:
/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:19:39: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
19 | ans = min(ans, dp_l[l] + dp_r[l + 1]);
| ^
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:3:
/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:19:39: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
19 | ans = min(ans, dp_l[l] + dp_r[l + 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:3:
/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:19:39: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
19 | ans = min(ans, dp_l[l] + dp_r[l + 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:3:
/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:19:39: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
19 | ans = min(ans, dp_l[l] + dp_r[l + 1]);
| ^