This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "boxes.h"
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
#define pb push_back
#define rsz resize
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define fi first
#define se second
int const N=1e7+3;
ll cw[N];
ll ccw[N];
ll delivery(int n, int K, int L1, int p1[]) {
ll L=L1;
vector<ll>p(n);
F0R(i,n)p[i]=p1[i];
cw[0]=0;
FOR(i,1,n+1)
{
cw[i]=min(2*p[i-1],L);
if(i>=K)
{
cw[i]+=cw[i-K];
}
}
ccw[0]=0;
FOR(i,1,n+1)
{
ccw[i]=min(2*(L-p[n-i]),L);
if(i>=K)
{
ccw[i]+=ccw[i-K];
}
}
ll ans=4e18;
F0R(i,n+1)
{
ll cand=cw[i]+ccw[n-i];
ans=min(ans,cand);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |