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 eb emplace_back
#define fi first
#define se second
typedef pair<int,int> p32;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
int res = INT_MAX;
int n = (int) s.size();
vector<p32> arr;
for(int i = 0; i<n; i++){
arr.eb(s[i],t[i]);
}
do{
int cost = 0;
for(int i = 1; i<n; i++){
cost +=max(0,arr[i-1].se-arr[i].fi);
}
res = min(res,cost);
}while(next_permutation(arr.begin(),arr.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... |