이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "boxes.h"
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rt insert
#define st first
#define nd second
#define ll long long
#define pii pair < int , int >
#define DB printf("debug\n");
#define umax( x , y ) x = max( x , (y) )
#define umin( x , y ) x = min( x , (y) )
#define all(x) x.begin() , x.end()
#define MAXN 10000005
using namespace std;
int n,k,l;
ll team_ven[MAXN];
ll min_art[MAXN];
ll min_azl[MAXN];
long long delivery(int N, int K, int L, int p[]) {
n=N,k=K,l=L;
for(int i=0;i<n;i++){
team_ven[i]=p[i];
}
int kn=k;
ll timee=0;
for(int i=0;i<n;i++){
if(kn>0){
if(i==0)timee+=team_ven[i];
else timee+=team_ven[i]-team_ven[i-1];
min_art[i]=timee;
kn--;
}
else{
timee+=team_ven[i-1]+team_ven[i];
min_art[i]=timee;
kn=k;
}
printf("i=%d team_ven=%lld kn=%d min_art=%lld\n",i,team_ven[i],kn,min_art[i]);
}
kn=k;
timee=0;
for(int i=n-1;i>=0;i--){
if(kn>0){
if(i==n-1)timee+=(l-team_ven[i]);
else timee+=team_ven[i+1]-team_ven[i];
min_azl[i]=timee;
kn--;
}
else{
timee+=(l-team_ven[i+1])+(l-team_ven[i]);
min_azl[i]=timee;
kn=k;
}
//printf("i=%d team_ven=%lld kn=%d min_azl=%lld\n",i,team_ven[i],kn,min_azl[i]);
}
ll ans=1e15;
for(int i=0;i<n;i++){
ans=min(ans,min_art[i]+min_azl[i+1]);
}
for(int i=0;i<n;i++){
if(i+k+1<=n)
ans=min(ans,min_art[i]+l+min_azl[i+k+1]);
}
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... |