| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1061547 | anango | Boxes with souvenirs (IOI15_boxes) | C++17 | 0 ms | 348 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 "boxes.h"
#include <bits/stdc++.h>
using namespace std;
int getdist(int L, int l, int r) {
    //go from sections l to r, with L
    if (r<l) swap(l,r);
    return min(min(2*r,(L-l)*2),L);
}
long long delivery(int N, int K, int L, int p[]) {
    int k = K; int n = N;
    vector<int> vals(N);
    for (int i=0; i<N; i++) {
        vals[i] = p[i];
    }
    sort(vals.begin(), vals.end());
    int rem = N%K;
    long long co1 = 0;
    for (int i=0; i<=N-k; i+=k) {
        //i through i+k-1
        co1+=getdist(L,vals[i],vals[i+k-1]);
    }
    co1+=getdist(L,vals[N-rem-1],vals[N-1]);
    return co1;
}
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... | ||||
