이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "shortcut_c.h"
#define N 1000000
#define INF 0x3f3f3f3f3f3f3f3f
long long min(long long a, long long b) { return a < b ? a : b; }
long long max(long long a, long long b) { return a > b ? a : b; }
long long abs_(long long a) { return a > 0 ? a : -a; }
long long find_shortcut(int n, int *ll, int *dd, int c) {
static long long xx[N];
int i, j, k, l;
long long d_, d;
for (i = 1; i < n; i++)
xx[i] = xx[i - 1] + ll[i - 1];
d_ = INF;
for (i = 0; i < n; i++)
for (j = i + 1; j < n; j++) {
d = 0;
for (k = 0; k < n; k++)
for (l = k + 1; l < n; l++)
d = max(d, dd[k] + dd[l] + min(abs_(xx[k] - xx[l]), abs_(xx[k] - xx[i]) + c + abs_(xx[j] - xx[l])));
d_ = min(d_, d);
}
return d_;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |