이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "boxes.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define lo long long
#define inf 1000000000000000000
#define md 1000000007
#define li 10000005
#define mp make_pair
#define pb push_back
using namespace std;
vector<lo int> l,r;
lo int ans=inf;
long long delivery(int N,int K,int L,int positions[]){
for(int i=0;i<N;i++){
if(positions[i]<=L/2){
l.pb(positions[i]*2);
}
else{
r.pb(2*L-positions[i]*2);
}
}
reverse(r.begin(),r.end());
for(int i=K;i<(int)l.size();i++){
l[i]+=l[i-K];
}
for(int i=K;i<(int)r.size();i++){
r[i]+=r[i-K];
}
for(int i=0;i<=K;i++){
int x=i;
int y=K-i;
ans=min(ans,(x<(int)l.size()?l[l.size()-1-x]:0)+(y<(int)r.size()?r[r.size()-1-y]:0)+L);
}
ans=min(ans,((int)l.size()>0?l.back():0)+((int)r.size()>0?r.back():0));
return ans;
}
# | 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... |