Submission #1035334

#TimeUsernameProblemLanguageResultExecution timeMemory
1035334ZicrusBoxes with souvenirs (IOI15_boxes)C++17
50 / 100
2075 ms29604 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; typedef long long ll; ll left(int n, int k, int l, vector<ll> p, int first) { ll sum = 0; ll pos = 0; for (int i = 0; i < n; i++) { sum += min(abs(p[i]-pos), l-abs(p[i]-pos)); pos = p[i]; if ((i+1+first) % k == 0) { sum += min(pos, l-pos); pos = 0; } } return sum + min(pos, l-pos); } 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 res = 1ll << 62ll; for (int i = 0; i < k; i++) { res = min(res, left(n, k, l, p, 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...