이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "boxes.h"
using namespace std;
#include<bits/stdc++.h>
long long delivery(int n, int k, int l, int p[]) {
int left;
int i = 0;
while(p[i] == 0)i++;
int t = -1;
long long ans = (long long)(n + k - i - 1) / k * l;
i += k - 1;
while(i < n && p[i] * 2 < l){
if(i == t){
break;
}
ans = ans - l + p[i] * 2;
t = max(i + k, n - 1);
i = t;
}
left = n - i;
t = -1;
int j = n - k;
while(l < p[j] * 2){
if(t == j){
break;
}
ans = ans + l - p[j] * 2;
t = max(0 , j - k);
left -=t - j;
j = t;
}
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... |