제출 #16518

#제출 시각아이디문제언어결과실행 시간메모리
16518ggoh선물상자 (IOI15_boxes)C++98
100 / 100
635 ms197232 KiB
#include<cstdio> #include<algorithm> long long a,i,mini,left[10000006],right[10000006]; long long min(long long XX,long long YY){return XX>YY?YY:XX;} long long delivery(int N,int K,int L,int positions[]) { for(i=0;i<N;i++) { left[i]=positions[i]<=L/2?positions[i]*2:L; if(i+1>K) { left[i]+=left[i-K]; } } for(i=N-1;i>=0;i--) { right[i]=(L-positions[i])<=L/2?(L-positions[i])*2:L; if(N-i>K) { right[i]+=right[i+K]; } } mini=min(left[N-1],right[0]); for(i=1;i<N-1;i++) { mini=min(mini,left[i]+right[i+1]); } return mini; }
#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...