# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
310148 | aZvezda | 선물상자 (IOI15_boxes) | C++14 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "boxes.h"
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#define endl "\n"
typedef long long ll;
template<class T, class T2> inline ostream &operator <<(ostream &out, const pair<T, T2> &x) { out << x.first << " " << x.second; return out;}
template<class T, class T2> inline istream &operator >>(istream &in, pair<T, T2> &x) { in >> x.first >> x.second; return in;}
template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const ll mod = 1e9 + 7;
#define out(x) "{" << (#x) << ": " << x << "} "
long long delivery(int N, int K, int L, ll p[]) {
ll l = 0, r = N - 1;
long long ret = 0;
ll k = K;
while(true) {
if(r - l + 1 <= k) {
ll curr = min(L, min(2 * L - 2 * p[l], 2 * p[r]));
for(ll i = l; i <= r - 1; i ++) {
if(p[i] <= L / 2 && p[i + 1] >= (L + 1) / 2) {
chkmin(curr, p[i] * 2ll + 2ll * L - 2ll * p[i + 1]);
}
}
ret += curr;
break;
}
if(min(2 * (L - p[r - k + 1]), L) < min(2ll * p[l + k - 1], L)) {
ret += min(2ll * (L - p[r - k + 1]), L);
r -= k;
} else {
ret += min(2ll * p[l + k - 1], L);
l += k;
}
}
return ret;
}
컴파일 시 표준 에러 (stderr) 메시지
boxes.cpp: In function 'long long int delivery(int, int, int, ll*)': boxes.cpp:22:61: error: no matching function for call to 'min(int&, const long long int&)' 22 | ll curr = min(L, min(2 * L - 2 * p[l], 2 * p[r])); | ^ 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/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from boxes.cpp:3: /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:22:61: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 22 | ll curr = min(L, min(2 * L - 2 * p[l], 2 * p[r])); | ^ 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/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from boxes.cpp:3: /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:22:61: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 22 | ll curr = min(L, min(2 * L - 2 * p[l], 2 * p[r])); | ^ In file included from /usr/include/c++/9/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from boxes.cpp:3: /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:22:61: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 22 | ll curr = min(L, min(2 * L - 2 * p[l], 2 * p[r])); | ^ In file included from /usr/include/c++/9/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from boxes.cpp:3: /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:22:61: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 22 | ll curr = min(L, min(2 * L - 2 * p[l], 2 * p[r])); | ^ boxes.cpp:31:41: error: no matching function for call to 'min(ll, int&)' 31 | if(min(2 * (L - p[r - k + 1]), L) < min(2ll * p[l + k - 1], 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/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from boxes.cpp:3: /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:31:41: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 31 | if(min(2 * (L - p[r - k + 1]), L) < min(2ll * p[l + k - 1], 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/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from boxes.cpp:3: /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:31:41: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 31 | if(min(2 * (L - p[r - k + 1]), L) < min(2ll * p[l + k - 1], L)) { | ^ In file included from /usr/include/c++/9/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from boxes.cpp:3: /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:31:41: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 31 | if(min(2 * (L - p[r - k + 1]), L) < min(2ll * p[l + k - 1], L)) { | ^ In file included from /usr/include/c++/9/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from boxes.cpp:3: /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:31:41: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 31 | if(min(2 * (L - p[r - k + 1]), L) < min(2ll * p[l + k - 1], L)) { | ^ boxes.cpp:31:70: error: no matching function for call to 'min(long long int, int&)' 31 | if(min(2 * (L - p[r - k + 1]), L) < min(2ll * p[l + k - 1], 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/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from boxes.cpp:3: /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:31:70: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 31 | if(min(2 * (L - p[r - k + 1]), L) < min(2ll * p[l + k - 1], 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/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from boxes.cpp:3: /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:31:70: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 31 | if(min(2 * (L - p[r - k + 1]), L) < min(2ll * p[l + k - 1], L)) { | ^ In file included from /usr/include/c++/9/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from boxes.cpp:3: /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:31:70: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 31 | if(min(2 * (L - p[r - k + 1]), L) < min(2ll * p[l + k - 1], L)) { | ^ In file included from /usr/include/c++/9/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from boxes.cpp:3: /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:31:70: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 31 | if(min(2 * (L - p[r - k + 1]), L) < min(2ll * p[l + k - 1], L)) { | ^ boxes.cpp:32:51: error: no matching function for call to 'min(long long int, int&)' 32 | ret += min(2ll * (L - p[r - k + 1]), 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/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from boxes.cpp:3: /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:32:51: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 32 | ret += min(2ll * (L - p[r - k + 1]), 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/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from boxes.cpp:3: /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:32:51: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 32 | ret += min(2ll * (L - p[r - k + 1]), L); | ^ In file included from /usr/include/c++/9/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from boxes.cpp:3: /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:32:51: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 32 | ret += min(2ll * (L - p[r - k + 1]), L); | ^ In file included from /usr/include/c++/9/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from boxes.cpp:3: /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:32:51: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 32 | ret += min(2ll * (L - p[r - k + 1]), L); | ^ boxes.cpp:35:45: error: no matching function for call to 'min(long long int, int&)' 35 | ret += min(2ll * p[l + k - 1], 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/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from boxes.cpp:3: /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:35:45: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 35 | ret += min(2ll * p[l + k - 1], 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/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from boxes.cpp:3: /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:35:45: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 35 | ret += min(2ll * p[l + k - 1], L); | ^ In file included from /usr/include/c++/9/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from boxes.cpp:3: /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:35:45: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 35 | ret += min(2ll * p[l + k - 1], L); | ^ In file included from /usr/include/c++/9/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from boxes.cpp:3: /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:35:45: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 35 | ret += min(2ll * p[l + k - 1], L); | ^