제출 #209368

#제출 시각아이디문제언어결과실행 시간메모리
209368autumn_eel선물상자 (IOI15_boxes)C++14
50 / 100
2098 ms4216 KiB
#include "boxes.h" #include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; typedef long long ll; const ll INF=0x3f3f3f3f3f3f3f3f; //~ ll s1[10000100],s2[10000100]; long long delivery(int N, int K, int L, int p[]) { ll Min=INF; for(int i=0;i<=N;i++){ //[0,i) [i,N) int cnt=0; ll sum=0; for(int j=i-1;j>=0;j--){ if(cnt==0)sum+=min(p[j],L-p[j]); else sum+=p[j+1]-p[j]; cnt++; if(cnt==K||j==0){ sum+=min(p[j],L-p[j]); cnt=0; } } for(int j=i;j<N;j++){ if(cnt==0)sum+=min(p[j],L-p[j]); else sum+=p[j]-p[j-1]; cnt++; if(cnt==K||j==N-1){ sum+=min(p[j],L-p[j]); cnt=0; } } Min=min(Min,sum); } return Min; }
#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...