제출 #69431

#제출 시각아이디문제언어결과실행 시간메모리
69431Vahan선물상자 (IOI15_boxes)C++17
10 / 100
2 ms380 KiB
#include "boxes.h" #include<algorithm> using namespace std; int count_clock[20000000],clock[20000000],pat; long long delivery(int N, int K, int L, int p[]) { for(int i=0;i<N;i++) { if(i<K) clock[i]=2*p[i]; else clock[i]=clock[i-K]+2*p[i]; } pat=clock[N-1]; for(int i=N-1;i>=0;i--) { if(i+K>N-1) count_clock[i]=2*(L-p[i]); else count_clock[i]=count_clock[i+K]+2*(L-p[i]); } pat=min(pat,count_clock[0]); pat=min(count_clock[K]+L,pat); for(int i=0;i<N-K;i++) pat=min(clock[i]+count_clock[i+K+1]+L,pat); for(int i=0;i<N;i++) pat=min(clock[i]+count_clock[i+1],pat); return pat; }
#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...