# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
20892 | baneling100 | Boxes with souvenirs (IOI15_boxes) | C++98 | 426 ms | 39536 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 <algorithm>
using namespace std;
long long Ans;
long long delivery(int N, int K, int L, int p[]) {
int i, j, half;
long long res;
half=upper_bound(p,p+N,L/2)-p-1;
for(i=half ; i>=0 ; i-=K)
Ans+=2*p[i];
for(i=half+1 ; i<N ; i+=K)
Ans+=2*(L-p[i]);
for(i=0 ; i<K ; i++) {
res=L;
for(j=half-i-1 ; j>=0 ; j-=K)
res+=2*p[j];
for(j=half-i+K ; j<N ; j+=K)
res+=2*(L-p[j]);
Ans=min(Ans,res);
}
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... |