제출 #716757

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