This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Ignut
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18 + 123;
ll plan_roller_coaster(vector<int> s, vector<int> t) {
int n = s.size();
vector<int> vec(n, 0);
iota(vec.begin(), vec.end(), 0);
ll res = INF;
do {
int speed = 1;
ll ans = 0;
for (int i : vec) {
ans += max(0, speed - s[i]);
speed = t[i];
}
res = min(res, ans);
} while (next_permutation(vec.begin(), vec.end()));
return res;
}
# | 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... |