Submission #434144

#TimeUsernameProblemLanguageResultExecution timeMemory
434144TangentBoxes with souvenirs (IOI15_boxes)C++17
20 / 100
1 ms204 KiB
#include "boxes.h" #include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vii; typedef vector<ll> vll; typedef vector<pii> vpii; typedef vector<pll> vpll; typedef vector<vii> vvii; typedef vector<vll> vvll; typedef vector<vpii> vvpii; typedef vector<vpll> vvpll; #define ffor(i, a, b) for (ll i = (a); i < (ll)(b); i++) #define fford(i, a, b) for (ll i = (a); i > (ll)(b); i--) #define rep(i, n) ffor(i, 0, n) #define forin(x, a) for (auto &x: a) #define all(a) a.begin(), a.end() long long delivery(int N, int K, int L, int p[]) { vll left = {0}, right = {0}; ffor(i, 1, N + 1) { if (i % K) { left.emplace_back(left[i - (i % K)] + min(2 * p[i - 1], L)); } else { left.emplace_back(left[i - K] + min(2 * p[i - 1], L)); } } ffor(i, 1, N + 1) { if (i % K) { right.emplace_back(right[i - (i % K)] + min(2 * (L - p[N - i]), L)); } else { right.emplace_back(right[i - K] + min(2 * (L - p[N - i]), L)); } } ll res = left[N]; rep(i, N) { res = min(res, left[i] + right[N - i]); } return res; }
#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...