# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
429057 | LouayFarah | Roller Coaster Railroad (IOI16_railroad) | C++14 | 2074 ms | 7988 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 "bits/stdc++.h"
#include "railroad.h"
using namespace std;
long long plan_roller_coaster(vector<int> s, vector<int> t)
{
int n = (int)s.size();
if(n<=16)
{
vector<int> pos(n);
for(int i = 0; i<n; i++)
pos[i] = i;
long long res = 1e18;
do
{
int speed = 1;
long long curr = 0;
for(int i = 0; i<n; i++)
{
if(speed>s[pos[i]])
curr+=speed-s[pos[i]];
speed = t[pos[i]];
}
res = min(res, curr);
}while(next_permutation(pos.begin(), pos.end()));
return res;
}
}
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... |