이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "boxes.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define debug(x) {cerr<<#x<<"="<<x<<"\n";}
#define debug2(x, y) {cerr<<#x<<", "<<#y<<"="<<x<<", "<<y<<"\n";}
#define debugp(p) {cerr<<#p<<"={"<<p.first<<", "<<p.second<<"}\n";}
#define all(x) x.begin(), x.end()
#define pb push_back
const int MAXN=10000100;
int A[MAXN];
ll dp[MAXN], pd[MAXN], ans=1e18;
ll delivery(int n, int k, int L, int AA[]){
for (int i=0; i<n; i++) A[i+1]=AA[i];
sort(A+1, A+n+1);
for (int i=1; i<=n; i++){
dp[i]=dp[max(0, i-k)]+min(2*A[i], L);
}
for (int i=n; i; i--){
pd[i]=pd[min(n+1, i+k)]+min(2*(L-A[i]), L);
}
for (int i=0; i<=n; i++) ans=min(ans, dp[i]+pd[i+1]);
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... |