제출 #963550

#제출 시각아이디문제언어결과실행 시간메모리
963550Hugo1729선물상자 (IOI15_boxes)C++11
10 / 100
1 ms348 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; typedef long long ll; ll delivery(int N, int K, int L, int p[]){ vector<ll> left(N+1,0),right(N+1,0); for(int i=0;i<N;i++){ if(i<K){ left[i+1]=min(p[i]*2,L); right[i+1]=min((L-p[N-1-i])*2,L); }else{ left[i+1]=min(p[i]*2,L)+left[i+1-K]; right[i+1]=min(L-p[N-1-i]*2,L)+right[i+1-K]; } } // for(int i=0;i<N;i++)p[i]=L-p[i]; // for(int i=0;i<N;i++){ // if(i<K){ // right[i+1]=min(p[i]*2,L); // }else{ // right[i+1]=min(p[i]*2,L)+right[i+1-K]; // } // } ll ans=LLONG_MAX; for(int i=0;i<N+1;i++)ans=min(ans,left[i]+right[N-i]); // for(int i=0;i<N+1;i++)cout << left[i] << ' '; // cout << '\n'; // for(int i=0;i<N+1;i++)cout << right[i] << ' '; // cout << '\n'; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...