# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
363584 | Sparky_09 | 선물상자 (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;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define trav(a, x) for(auto& a : x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
void usaco(string s){
freopen((s+".in").c_str(), "r", stdin);
freopen((s+".out").c_str(), "w", stdout);
}
int delivery(int n, int k, int l, int pos[]){
vector<ll> pre(n+2, 0), suf(n+2, 0);
for(int i = 1; i <= n; i++){
pre[i] = min(pre[i-k>=0?i-k:0] + 2 * pos[i-1], l);
suf[i] = min(suf[i-k>=0?i-k:0] + 2 * (l - pos[n-i]), l);
}
ll ans = 1e18;
for(int i = 0; i <= n; i++){
ans = min(ans, pre[i] + suf[n-i]);
}
return ans;
}
Compilation message (stderr)
boxes.cpp: In function 'int delivery(int, int, int, int*)': boxes.cpp:20:52: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int&)' 20 | pre[i] = min(pre[i-k>=0?i-k:0] + 2 * pos[i-1], l); | ^ In file included from /usr/include/c++/9/bits/specfun.h:45, from /usr/include/c++/9/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41, from boxes.cpp:1: /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:20:52: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 20 | pre[i] = min(pre[i-k>=0?i-k:0] + 2 * pos[i-1], l); | ^ In file included from /usr/include/c++/9/bits/specfun.h:45, from /usr/include/c++/9/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41, from boxes.cpp:1: /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:20:52: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 20 | pre[i] = min(pre[i-k>=0?i-k:0] + 2 * pos[i-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:1: /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:20:52: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 20 | pre[i] = min(pre[i-k>=0?i-k:0] + 2 * pos[i-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:1: /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:20:52: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 20 | pre[i] = min(pre[i-k>=0?i-k:0] + 2 * pos[i-1], l); | ^ boxes.cpp:21:58: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int&)' 21 | suf[i] = min(suf[i-k>=0?i-k:0] + 2 * (l - pos[n-i]), l); | ^ In file included from /usr/include/c++/9/bits/specfun.h:45, from /usr/include/c++/9/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41, from boxes.cpp:1: /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:21:58: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 21 | suf[i] = min(suf[i-k>=0?i-k:0] + 2 * (l - pos[n-i]), l); | ^ In file included from /usr/include/c++/9/bits/specfun.h:45, from /usr/include/c++/9/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41, from boxes.cpp:1: /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:21:58: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 21 | suf[i] = min(suf[i-k>=0?i-k:0] + 2 * (l - pos[n-i]), 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:1: /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:21:58: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 21 | suf[i] = min(suf[i-k>=0?i-k:0] + 2 * (l - pos[n-i]), 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:1: /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:21:58: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 21 | suf[i] = min(suf[i-k>=0?i-k:0] + 2 * (l - pos[n-i]), l); | ^ boxes.cpp:27:9: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion] 27 | return ans; | ^~~ boxes.cpp: In function 'void usaco(std::string)': boxes.cpp:13:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] 13 | freopen((s+".in").c_str(), "r", stdin); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ boxes.cpp:14:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] 14 | freopen((s+".out").c_str(), "w", stdout); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~