이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "shortcut.h"
#define ll long long
using namespace std;
const int maxn = 505;
const ll inf = (1LL << 60);
ll dpoc[maxn];
ll find_shortcut(int n, vector<int> l, vector<int> d, int c){
for(int i = 1; i < n; i++){
dpoc[i] = dpoc[i - 1] + l[i - 1];
}
ll ans = inf;
for(int a = 0; a < n; a++){
for(int b = a + 1; b < n; b++){
ll maks = 0;
for(int x = 0; x < n; x++){
for(int y = x + 1; y < n; y++){
ll dxa = abs(dpoc[x] - dpoc[a]);
ll dxb = abs(dpoc[x] - dpoc[b]);
ll dya = abs(dpoc[y] - dpoc[a]);
ll dyb = abs(dpoc[y] - dpoc[b]);
ll dxy = abs(dpoc[x] - dpoc[y]);
dxa = min(dxa, dxb + c);
dxb = min(dxb, dxa + c);
dya = min(dya, dyb + c);
dyb = min(dyb, dya + c);
// maks = max(maks, dxy + d[x] + d[y]);
maks = max(maks, min(dxy, min(dxa + dya, dxb + dyb)) + d[x] + d[y]);
// if(maks == 110) cout << x << ' ' << y << ' ' << dxa << ' ' << dya << endl;
}
}
// cout << a << ' ' << b << ' ' << maks << endl;
ans = min(ans, maks);
}
}
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... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |