이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "boxes.h"
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;
ll delivery(int n, int k, int l, int p[]) {
sort(p, p+n);
ll sol=0;
if(k==1){
for(int i=0; i<n; i++){
sol+=min(p[i], l-p[i])*2;
}
}
else if(k==n){
sol=l;
sol=min(sol, (ll)(l-p[0])*2);
sol=min(sol, (ll)p[n-1]*2);
for(int i=0; i<n-1; i++){
sol=min(sol, (ll)p[i]*2+(l-p[i+1])*2);
}
}
return sol;
}
# | 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... |