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 PB push_back
using namespace std;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
int n = (int) s.size();
vector<int>permutacion;
for(int i = 0 ;i < n ; i ++){
permutacion.PB(i);
}
long long ret=-1, sum=0, vel;
do{
sum=0, vel=1;
for(int i = 0 ; i < n ; i ++){
if(vel<=s[permutacion[i]]){
}else{
sum+=vel-s[permutacion[i]];
}
vel=t[permutacion[i]];
}
if(ret==-1)ret=sum;
else ret=min(ret, sum);
}while(next_permutation(permutacion.begin(), permutacion.end()));
return ret;
}
# | 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... |