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;
ll plan_roller_coaster(vector<int> s, vector<int> t)
{
const int N = (int)s.size();
vector<int> perm(N);
iota(perm.begin(), perm.end(), 0);
ll res = 1ll << 60;
do
{
int speed = 0;
ll temp = 0;
for (int i = 0; i < N; i++)
{
temp += max(0, speed - s[perm[i]]);
speed = t[perm[i]];
}
res = min(res, temp);
} while (next_permutation(perm.begin(), perm.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... |