이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using pi = pair<ll, pair<ll, ll>>;
using ii = pair<int, int>;
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
ll lf[10000001], rf[10000001];
ll delivery(int N, int K, int L, int P[]) {
ll res = 1e18;
for(int l = 1; l <= N; l++) {
if(l >= K) lf[l] += lf[l - (l % K)];
ll A = P[l - 1] + min(L - P[l - 1], P[l - 1]);
lf[l] += min(ll(L), A);
}
for(int l = N; l >= 1; l--) {
int i = N - l + 1;
if(i >= K) rf[l] += rf[l + (i % K)];
ll A = L - P[l - 1] + min(L - P[l - 1], P[l - 1]);
rf[l] += min(ll(L), A);
}
for(int l = 0; l <= N; l++) {
res = min(res, lf[l] + rf[l + 1]);
}
return res;
}
# | 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... |