# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
789785 | Minindu206 | Roller Coaster Railroad (IOI16_railroad) | C++14 | 2067 ms | 4172 KiB |
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;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
int n = s.size();
long long ans = LLONG_MAX;
vector<int> perm(s);
iota(perm.begin(), perm.end(), 0);
do
{
long long cur = 0LL;
int st = t[perm[0]];
// for(int i=0;i<n;i++)
// cout << perm[i] << " ";
// cout << '\n';
for(int i=1;i<n;i++)
{
int dis = t[perm[i - 1]] - s[perm[i]];
cur += (dis > 0 ? dis : 0);
// cout << (dis > 0 ? dis : 0) << " ";
}
// cout << '\n';
ans = min(ans, cur);
} while (next_permutation(perm.begin(), perm.end()));
return ans;
}
Compilation message (stderr)
# | 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... |