# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134519 | Boxworld | Boxes with souvenirs (IOI15_boxes) | C++14 | 2 ms | 380 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;
long long delivery(int N, int K, int L, int p[]){
if (K==1){
long long ans=0;
for (int i=0;i<N;i++){
if (p[i]*2<L)ans=ans+p[i]*2;
else ans=ans+(L-p[i])*2;
}
return ans;
}else if (K==N){
int Mli=p[0],Mlx=p[0],Mri=p[N-1],Mrx=p[N-1];
for (int i=0;i<N;i++){
if (p[i]*2<L)Mlx=p[i];
if (p[i]*2==L)return L;
if (p[i]*2>L){Mri=p[i];break;}
}
if (Mli*2>L){
return (L-Mli)*2;
}else if (Mrx*2<L){
return Mrx*2;
}else{
if (L<Mlx*2+(L-Mri)*2)return L;
else return Mlx*2+(L-Mri)*2;
}
}
}
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... |