제출 #356543

#제출 시각아이디문제언어결과실행 시간메모리
356543leinad2선물상자 (IOI15_boxes)C++17
100 / 100
704 ms278908 KiB
#include "boxes.h" #include<bits/stdc++.h> using namespace std; long long i, n, k, l, ans, A[10000010], X[10000010], Y[10000010]; long long delivery(int N, int K, int L, int p[]) { n=N; k=K; l=L; for(i=0;i<n;i++)A[i]=p[i]; for(i=0;i<n;i++) { if(i>=k)X[i]=X[i-k]+min(l, 2*A[i]); else X[i]=min(l, 2*A[i]); } for(i=n-1;i>=0;i--) { if(i>n-1-k)Y[i]=min(l, 2*(l-A[i])); else Y[i]=Y[i+k]+min(l, 2*(l-A[i])); } ans=Y[0]; for(i=0;i<n;i++) { ans=min(ans, X[i]+Y[i+1]); } 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...