Submission #1000007

#TimeUsernameProblemLanguageResultExecution timeMemory
1000007coolboy19521Boxes with souvenirs (IOI15_boxes)C++17
100 / 100
523 ms450524 KiB
#include "bits/stdc++.h" #include "boxes.h" #define intt long long using namespace std; const intt sz = 1e7 + 7; intt pr[sz], su[sz], fo[sz], ba[sz]; long long delivery(int N, int K, int L, int p[]) { for (intt i = 0; i < N; i ++) { pr[i] = min(L, p[i] * 2); } for (intt i = 0; i < N; i ++) { su[i] = min(L, (L - p[i]) * 2); } for (intt i = 0; i < N; i ++) { fo[i] = pr[i]; if (i >= K) { fo[i] += fo[i - K]; } } for (intt i = N - 1; -1 < i; i --) { ba[i] = su[i]; if (i + K < N) { ba[i] += ba[i + K]; } } intt mn = ba[0]; for (intt i = 0; i < N; i ++) { mn = min(mn, fo[i] + ba[i + 1]); } return mn; }
#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...