이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "boxes.h"
#include <bits/stdc++.h>
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(20) << (x)
#define all(v) (v).begin(), (v).end()
using namespace std;
#define forn(i,n) for (int i = 0; i < (n); ++i)
#define rforn(i, n) for(int i = (n) - 1;i >= 0;--i)
using ll = long long;
int mod = (ll)1e9 + 7;
#define PI acos(-1)
typedef pair<int, int> pairs;
const int INF = 1e9 + 1;
const int N = 1e7 + 10;
const double eps = 1e-7;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <typename XPAX>
void ckma(XPAX &x, XPAX y) {
x = (x < y ? y : x);
}
template <typename XPAX>
void ckmi(XPAX &x, XPAX y) {
x = (x > y ? y : x);
}
ll dp[4][N];
ll delivery(int n, int k, int l, int p[]) {
forn(i, n) {
if(i < k) dp[1][i] = p[i] * 2;
else dp[1][i] = dp[1][i - k] + min(p[i] * 2, l);
}
dp[2][n] = 0;
rforn(i, n) {
if(i + k - 1 > n - 1) dp[2][i] = (l - p[i]) * 2;
else dp[2][i] = dp[2][i + k] + min(l, (l - p[i]) * 2);
}
ll ret = 1e18;
forn(i, n) ckmi(ret, dp[1][i] + dp[2][i + 1]);
ckmi(ret, dp[2][0]);
ckmi(ret, dp[1][n - 1]);
return ret;
}
# | 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... |