제출 #259715

#제출 시각아이디문제언어결과실행 시간메모리
259715uacoder123선물상자 (IOI15_boxes)C++14
100 / 100
575 ms293320 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; #define F first #define S second #define FOR(i,a,b) for (auto i = (a); i <= (b); ++i) #define NFOR(i,a,b) for(auto i = (a); i >= (b); --i) #define all(x) (x).begin(), (x).end() #define sz(x) int(x.size()) #define mp(i,a) make_pair(i,a) #define pb(a) push_back(a) #define bit(x,b) (x&(1LL<<b)) typedef long long int lli; typedef pair <lli,lli> ii; typedef pair <lli,ii> iii; typedef vector <lli> vi; lli arr[10000000],arr1[10000000],ans=0; long long delivery(int N, int K, int L, int p[]) { lli n,k,l; n=N; k=K; l=L; for(lli i=0;i<n;++i) { arr[i]=p[i]*2+((i-k>=0)?arr[i-k]:0*1LL); } for(lli i=n-1;i>=0*1LL;--i) arr1[i]=(l-p[i])*2+((i+k<=n-1)?arr1[i+k]:0*1LL); ans=min(arr[n-1],arr1[0*1LL]); for(lli i=0*1LL;i<n-1;++i) ans=min(ans,arr[i]+arr1[i+1]); for(lli i=0*1LL;i<=n;++i) ans=min(ans,((i>0*1LL)?arr[i-1]:0*1LL)+l+((n-i-k>0*1LL)?arr1[(n)-(n-k-i)]:0*1LL)); 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...