이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "boxes.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
int n, k, l;
vector<int> lhalf, rhalf;
int lsize, rsize;
long long delivery(int N, int K, int L, int p[]){
lld cost = 0;
n = N; k = K; l = L;
if(n==1) return min((lld)2*p[0], (lld)2*(l-p[0]));
for(int i=0;2*p[i]<=l;i++){
lhalf.push_back(p[i]);
}
lsize = (int) lhalf.size();
for(int i=n-1;2*(l-p[i])<l;i--){
rhalf.push_back(l-p[i]);
}
rsize = (int) rhalf.size();
if(2*lhalf[lsize-1]+2*rhalf[rsize-1]<=l){
int pos_right = rsize-1;
int pos_left = lsize-1;
while(pos_right>=0){
cost += 2*rhalf[pos_right];
pos_right -= k;
}
while(pos_left>=0){
cost += 2*lhalf[pos_left];
pos_left -= k;
}
}else{
while(true){}
}
return cost;
}
# | 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... |