이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "shortcut.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
long long find_shortcut(int n, std::vector<int> len, std::vector<int> d, int c){
vi pref;
pref.assign(n,0);
for (ll i = 1; n > i; i++){
pref[i] = pref[i-1] + len[i-1];
}
ll ans = 1e18;
for (ll l = 0; n > l; l++){
for (ll r = l+1; n > r; r++){
ll diam = 0;
for (ll i = 0; n > i; i++){
for (ll j = i+1; n > j; j++){
ll cur = pref[j]-pref[i]+d[j]+d[i];
cur = min(cur,c+abs(pref[i]-pref[l])+abs(pref[j]-pref[r])+d[j]+d[i]);
diam = max(diam,cur);
/*
if (l <= i && j <= r){
cur = min(cur,pref[r]-pref[l]+(pref[i]-pref[l])+(pref[r]-pref[j]));
}else if (i < l && j <= r){
cur = min(cur,pref[r]-pref[l]+(pref))
}else if (l <= i && r < j){
}else if (i < l && r < j){
}
*/
}
}
ans = min(ans,diam);
}
}
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... |