제출 #716760

#제출 시각아이디문제언어결과실행 시간메모리
716760Baytoro선물상자 (IOI15_boxes)C++17
0 / 100
1 ms340 KiB
#include "boxes.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; #define ll long long const int N=1e7+5; ll pref[N],suf[N]; long long delivery(int n, int k, int L, int p[]) { ll ans=1e18; for(int i=0;i<n;i++){ if(i<k) pref[i+1]=p[i]*2; else pref[i+1]=pref[i+1-k]+p[i]*2; } for(int i=n-1;i>=0;i--){ if(i+k+1>n) suf[i]=2*(L-p[i]); else suf[i]=suf[i+k+1]+2*(L-p[i]); } for(int i=0;i<=n;i++){ ans=min(ans,pref[i]+suf[i+1]); ans=min(ans,pref[i]+L+suf[min(n+1,i+k+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...