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>
#define ll long long int
#define vi vector<int>
#define pb push_back
using namespace std;
long long plan_roller_coaster(vector<int> s,vector<int> t) {
int n=(int)s.size();
ll res=1e18;
vi a;
for(int i=0;i<n;i++)
a.pb(i);
do{
ll G=0,c=0;
for(int i=0;i<n;i++)
{
if(c>s[a[i]])
G+=(c-s[a[i]]);
c=t[a[i]];
}
res=min(res,G);
}while(next_permutation(a.begin(),a.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... |