# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
826983 | tolbi | Shortcut (IOI16_shortcut) | C++17 | 1 ms | 300 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#include "shortcut.h"
long long find_shortcut(int n, std::vector<int> pref, std::vector<int> d, int c)
{
for (int i = 1; i < pref.size(); i++){
pref[i]+=pref[i-1];
}
function<ll(int,int)> query;
query = [&](int l, int r)->ll{
if (r<l) swap(l,r);
r--;
int hueh = 0;
if (l) hueh = pref[l-1];
return pref[r]-hueh;
};
ll ans = LONG_LONG_MAX;
for (int l = 0; l < n; l++){
for (int r = l+1; r < n; r++){
ll crr = 0;
for (int i = 0; i < n; i++){
for (int j = i+1; j < n; j++){
ll cr1 = query(i,j);
ll cr2 = query(l,i)+query(r,j)+c;
crr=max(crr,min(cr1,cr2)+(ll)d[i]+(ll)d[j]);
}
}
ans=min(ans,crr);
}
}
return ans;
}
Compilation message (stderr)
# | 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... |