제출 #836733

#제출 시각아이디문제언어결과실행 시간메모리
836733AbdelmagedNourBoxes with souvenirs (IOI15_boxes)C++17
10 / 100
1 ms336 KiB
#include <bits/stdc++.h> using namespace std; //#include "grader.cpp" #include "boxes.h" long long delivery(int N, int K, int L, int p[]){ vector<long long>pre(K+1),suf(K+1); long long res=LLONG_MAX; for(int i=K-1;i<N;i++)suf[i%K]+=L-p[i]; for(int i=K-1;i<N;i++){ int l=p[i-K+1],r=p[i]; suf[i%K]-=L-p[i]; if(i>=K)pre[i%K]+=p[i-K]; int cost=min({L,2*r,2*(L-l)}); res=min(res,cost+2*pre[i%K]+2*suf[(i+1)%K]); } return res; }
#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...