제출 #30564

#제출 시각아이디문제언어결과실행 시간메모리
30564inqr선물상자 (IOI15_boxes)C++14
0 / 100
2 ms376 KiB
#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; ll art[MAXN]; ll azl[MAXN]; long long delivery(int N, int K, int L, int p[]) { ll ans=1e18; for(int i=0;i<N;i++){ if(i<K)art[i]=min(2*p[i],L); else art[i]=art[i-K]+min(2*p[i],L); } for(int i=N-1;i>=0;i--){ if(N-1-i<K)azl[i]=min(2*(L-p[i]),L); else azl[i]=azl[i+K]+min(2*(L-p[i]),L); } umin(ans,art[N-1]); umin(ans,azl[0]); for(int i=0;i<N-1;i++){ umin(ans,art[i]+azl[i+1]); } cout<<ans<<endl; 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...