Submission #386607

#TimeUsernameProblemLanguageResultExecution timeMemory
386607ParsaAlizadehBoxes with souvenirs (IOI15_boxes)C++17
100 / 100
677 ms300700 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; typedef long long ll; ll delivery(int N, int K, int L, int p[]) { vector<ll> tmp(K), dpl(N), dpr(N); for (int i = 0; i < N; i++) { tmp[i % K] += p[i] + min(p[i], L - p[i]); dpl[i] = tmp[i % K]; } tmp.assign(K, 0); for (int i = N; i--; ) { tmp[i % K] += L - p[i] + min(p[i], L - p[i]); dpr[i] = tmp[i % K]; } ll ans = min(dpl[N - 1], dpr[0]); for (int i = 1; i < N; i++) ans = min(ans, dpl[i - 1] + dpr[i]); 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...