Submission #373611

#TimeUsernameProblemLanguageResultExecution timeMemory
373611SnowFlake7Boxes with souvenirs (IOI15_boxes)C++14
100 / 100
542 ms235168 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; long long s1[10000005],s2[10000005]; long long delivery(int n, int k, int l, int poz[]) { long long ans = -1; for(int i = 1;i <= n;i++) { if (i < k) s1[i] = min(2 * poz[i - 1], l); else s1[i] = min(2 * poz[i - 1], l) + s1[i - k]; } for (int i = n;i >= 1;i--) { if (i > n - k + 1) s2[i] = min(2 * (l - poz[i - 1]), l); else s2[i] = s2[i + k] + min(2 * (l - poz[i - 1]), l); } for (int i = 0;i <= n;i++) { if (ans == -1) ans = s1[i] + s2[i + 1]; ans = min(ans, s1[i] + s2[i + 1]); } 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...