이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "boxes.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
using namespace std;
typedef pair<ll,ll> pii;
const ll MAXN = 1e7+10;
const ll INF = 2e18+10;
int n, k, l;
int a[MAXN];
ll ans = INF;
long long delivery(int N, int K, int L, int p[]) {
n = N; k = K; l = L;
for(int i=0; i<n; i++) a[i+1] = p[i];
//cout << n << ' ' << k << ' ' << a[1] << " p\n";
ll nw = 0;
for(int i=0; i<=n; i++){ // paling terakhirnya ada di i
nw = 0;
for(int j=i; j>=1; j-=k){
if(a[j] <= l/2) nw += 2*a[j];
else nw += l;
}
for(int j=i+1; j<=n; j+=k){
if(a[j] <= l/2) nw += l;
else nw += 2*(l-a[j]);
}
ans = min(ans, nw);
}
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... |