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>
#include "railroad.h"
#ifdef MINA
#include "grader.cpp"
#endif
using namespace std;
#define ll long long
ll plan_roller_coaster(vector<int> s, vector<int> t) {
int n = s.size();
int a[n];
for (int i = 0; i < n; i++) {
a[i] = i;
}
ll ans = 1e18;
do {
ll sum = 0;
for (int i = 0; i + 1 < n; i++) {
sum += max(0, t[a[i]] - s[a[i + 1]]);
}
ans = min(ans, sum);
} while (next_permutation(a, a + n));
return ans;
}
# | 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... |