제출 #225700

#제출 시각아이디문제언어결과실행 시간메모리
225700staniewzki선물상자 (IOI15_boxes)C++17
100 / 100
885 ms151912 KiB
#include<bits/stdc++.h> using namespace std; #define REP(i, n) for(int i = 0; i < n; i++) #define FOR(i, a, b) for(int i = a; i <= b; i++) #define ST first #define ND second ostream& operator<<(ostream &out, string str) { for(char c : str) out << c; return out; } template<class L, class R> ostream& operator<<(ostream &out, pair<L, R> p) { return out << "(" << p.ST << ", " << p.ND << ")"; } template<class T> auto operator<<(ostream &out, T a) -> decltype(a.begin(), out) { out << "{"; for(auto it = a.begin(); it != a.end(); it = next(it)) out << (it != a.begin() ? ", " : "") << *it; return out << "}"; } void dump() { cerr << "\n"; } template<class T, class... Ts> void dump(T a, Ts... x) { cerr << a << ", "; dump(x...); } #ifdef DEBUG # define debug(...) cerr << "[" #__VA_ARGS__ "]: ", dump(__VA_ARGS__) #else # define debug(...) false #endif template<class T> int size(T && a) { return (int) a.size(); } using LL = long long; using PII = pair<int, int>; #include "boxes.h" long long delivery(int N, int K, int L, int p[]) { sort(p, p + N); vector<LL> left(K), right(K); REP(i, N) left[(i + 1) % K] += min(2 * p[i], L); LL ans = left[N % K]; for(int i = N - 1; i >= 0; i--) { left[(i + 1) % K] -= min(2 * p[i], L); right[i % K] += min(2 * (L - p[i]), L); ans = min(ans, left[i % K] + right[i % K]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...