Submission #1034056

#TimeUsernameProblemLanguageResultExecution timeMemory
1034056ZicrusBoxes with souvenirs (IOI15_boxes)C++17
10 / 100
1 ms348 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; typedef long long ll; ll delivery(int n, int k, int l, int p11[]) { vector<ll> p(n); for (int i = 0; i < n; i++) p[i] = p11[i]; ll sum = 0; ll first = 0, last = k-1; while (last < n-1) { sum += min(p[first], l-p[first]) + min(p[last]-p[first], l-(p[last]-p[first])) + min(p[last], l-p[last]); first += k; last += k; } last = n-1; sum += min(p[first], l-p[first]) + p[last]-p[first] + min(p[last], l-p[last]); return sum; }
#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...