Submission #1069583

#TimeUsernameProblemLanguageResultExecution timeMemory
1069583IgnutShortcut (IOI16_shortcut)C++17
0 / 100
1 ms348 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; r < n; r ++) { ll ans = 0; for (int i = 0; i < n; i ++) { for (int j = i; j < n; j ++) { ll dist = min(pref[j] - pref[i], min(abs(pref[i] - pref[l]), abs(pref[i] - pref[r])) + min(abs(pref[j] - 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...