# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
959281 | hyakup | Roller Coaster Railroad (IOI16_railroad) | C++17 | 2088 ms | 8396 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;
#define ll long long
const ll inf = 1e18;
ll plan_roller_coaster( vector<int> s, vector<int> t) {
int n = s.size();
ll resp = inf;
vector<int> p;
for( int i = 0; i < n; i++ ) p.push_back(i);
do{
ll ans = 0;
for( int i = 1; i < p.size(); i++ ) ans += max( (ll)t[p[i - 1]] - (ll)s[p[i]], 0LL );
resp = min( resp, ans );
}while( next_permutation(p.begin(), p.end()) );
return resp;
}
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... |