# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
650622 | birthdaycake | Boxes with souvenirs (IOI15_boxes) | C++17 | 1 ms | 300 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include "boxes.h"
using namespace std;
long long delivery(int n, int k, int l, int p[]) {
int ans = INT_MAX;
for(int i = 0; i < n; i++){
int cur = 0, items = k, cost = 0, dist;
for(int j = 0; j <= i; j++){
if(items == 0){
items = k;
cost += dist;
cur = 0;
dist = 0;
}
cost += (p[j] - cur);
dist += (p[j] - cur);
cur = p[j];
items--;
}
cost += dist;
items = k;
cur = 0;
dist = 0;
for(int j = n - 1; j > i; j--){
int nw = l - p[j] + 1;
if(items == 0){
items = k;
cost += dist;
cur = 0;
dist = 0;
}
cost += (nw - cur);
dist += (nw- cur);
cur = nw;
items--;
}
ans = min(ans, cost);
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |