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>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define all(v) v.begin(), v.end()
#define pb push_back
#define ss second
#define ff first
#define vt vector
using namespace std;
//using namespace __gnu_pbds;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;
const ll inf = 1e18 + 10000;
const int mod = 1e9+7;
const int maxn = 1e5 + 12;
long long delivery(int n, int k, int l, int p[]) {
vi P((n + k - 1) / k * k);
for(int i = 0; i < (n + k - 1) / k * k; i++){
P[i] = p[min(n - 1, i)];
}
ll ret = 0, ter = 0;
for(int i = 0; i < n; i += k){
ret += min(min(P[i + k - 1] * 2, (l - P[i]) * 2), l);
}
for(int i = 0; i < (n + k - 1) / k * k; i++){
P[i] = p[n - min(n - 1, i) - 1];
}
for(int i = 0; i < n; i += k){
ter += min(min(P[i] * 2, (l - P[i + k - 1]) * 2), l);
}
return min(ret, ter);
}
# | 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... |