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 "railroad.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> v;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
int n = s.size();
for(int i = 0; i < n; i++) v.push_back(i);
ll best = 99999999999999999;
do {
ll ans = 0;
for(int i = 0; i < n-1; i++) {
ans += max(0, t[v[i]] - s[v[i+1]]);
}
best = min(ans, best);
} while(next_permutation(v.begin(), v.end()));
return best;
}
# | 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... |