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;
#define pb push_back
#define f1 first
#define s2 second
#define size(x) (int)x.size()
using ll = long long;
using ii = pair<int, int>;
const ll inf = 1e18 + 69;
ll plan_roller_coaster(vector<int> s, vector<int> t) {
int n = size(s);
vector<ii> v(n);
for (int i = 0; i < n; ++i)
v[i] = {s[i], t[i]};
ll mn = inf;
do
{
ll ctr = 0;
for (int i = 0, cur = 1; i < n; ++i)
{
ctr += max(0, cur - v[i].f1);
cur = v[i].s2;
}
mn = min(mn, ctr);
} while (next_permutation(v.begin(), v.end()));
return mn;
}
# | 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... |