이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "boxes.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pii;
#define precision(n) fixed << setprecision(n)
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define eps (double)1e-9
#define PI 2*acos(0.0)
#define endl "\n"
#define sz(v) (v).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 1e7+7;
vector <ll> needl(N), needr(N), v(N);
int n, k, cir;
ll delivery(int NN, int KK, int LL, int p[]){
int i;
n = NN; k = KK; cir = LL;
for(i = 0; i < n; i++){
v[i+1] = p[i];
}
for(i = 1; i <= n; i++){
needl[i] = needl[max(0, i-k)]+v[i]*2;
}
for(i = n; i >= 1; i--){
needr[i] = needr[min(n+1, i+k)]+(cir-v[i])*2;
}
ll mn = 9e18;
for(i = 0; i <= n; i++){
mn = min(mn, needl[i]+needr[i+1]);
}
for(i = 0; i <= n; i++){
mn = min(mn, needl[i]+cir+needr[min(n+1, i+k+1)]);
}
return mn;
}
# | 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... |