제출 #1069596

#제출 시각아이디문제언어결과실행 시간메모리
1069596IgnutShortcut (IOI16_shortcut)C++17
31 / 100
2051 ms604 KiB
// Ignut #include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 1e18 + 123; ll find_shortcut(int n, vector<int> l, vector<int> d, int c) { ll pref[n] = {}; for (int i = 0; i < n - 1; i ++) pref[i + 1] = pref[i] + l[i]; ll res = INF; for (int l = 0; l < n; l ++) { for (int r = l + 1; r < n; r ++) { ll ans = 0; for (int i = 0; i < n; i ++) { ans = max(ans, 1ll * d[i]); for (int j = i + 1; j < n; j ++) { ll dist = min(pref[j] - pref[i], abs(pref[i] - pref[l]) + abs(pref[j] - pref[r]) + c) + d[i] + d[j]; ans = max(ans, dist); } } res = min(res, ans); } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...