# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
538599 | chaoyue | Boxes with souvenirs (IOI15_boxes) | C++14 | 1 ms | 468 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;
#define ll long long
ll delivery(int N, int K, int L, int p[]){
ll split = L/2, idx=0, lsize=1, rsize=1, f0, ans;
vector<ll> left(N), right(N);
left[0] = 0, right[0] = 0;
while(idx < N && p[idx] <= split){
left[lsize] = p[idx] * 2;
if(lsize >= K) left[lsize] += left[lsize-K];
idx++, lsize++;
}
while(idx < N){
right[rsize] = (L - p[idx]) * 2;
if(rsize >= K) right[rsize] += right[rsize-K];
idx++, rsize++;
}
//left is non-decreasing
//pre array will flip left & right arrays
vector<ll> lpre(lsize), rpre(rsize);
lpre[0] = 0; rpre[0] = 0;
for(ll i=1; i<lsize; i++){
lpre[i] = lpre[i-1] + left[lsize-i] - left[lsize-i-1];
}
for(ll i=1; i<rsize; i++){
rpre[i] = rpre[i-1] + right[rsize-i] - right[rsize-i-i];
}
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... |