제출 #430963

#제출 시각아이디문제언어결과실행 시간메모리
430963KalasLavas선물상자 (IOI15_boxes)C++14
0 / 100
0 ms204 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; #define F first #define S second using ll = long long; using pii= pair<int,int>; using pll= pair<ll,ll>; int n,k,len,*p; ll ans=LLONG_MAX; ll delivery(int _N, int _K, int _L, int _p[]) { n=_N; k=_K; len=_L; p=_p; for(int i=0;i<n;i++) { bool fl=0; ll res = 0; for(int j=i-1;j>=0;j-=k) res+=p[j]<<1; int j; //cerr<<">"<<res<<endl; for(j=i;j<n;j+=k) { if(((len-p[j])<<1)<=len) { if(fl) j-=k; //cerr<<">"<<res<<endl; for(;j<n;j+=k) res+=(len-p[j])<<1; break; } fl=1; res+=len; } //cerr<<res<<endl; ans = min(res,ans); } return ans; } /* 4 8 8 3 4 5 6 4 8 9 3 4 5 6 5 3 25 1 4 13 20 21 :32 3 2 8 1 2 5 */
#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...