Submission #1046039

#TimeUsernameProblemLanguageResultExecution timeMemory
1046039Gromp15Shortcut (IOI16_shortcut)C++17
31 / 100
2054 ms604 KiB
#include "shortcut.h" #include <bits/stdc++.h> #define ll long long using namespace std; template<typename T> bool ckmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; } template<typename T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; } long long find_shortcut(int n, std::vector<int> l, std::vector<int> d, int c) { ll ans = 1e18; vector<ll> p(n); for (int i = 1; i < n; i++) p[i] = p[i-1] + l[i-1]; for (int i = 0; i < n; i++) { for (int j = i+1; j < n; j++) { ll cur = 0; for (int k = 0; k < n; k++) { for (int l = k+1; l < n; l++) { ckmax(cur, d[k] + d[l] + min(p[l] - p[k], abs(p[k] - p[i]) + abs(p[l] - p[j]) + c)); } } ckmin(ans, cur); } } return ans; }
#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...