Submission #1020511

#TimeUsernameProblemLanguageResultExecution timeMemory
1020511vjudge1Roller Coaster Railroad (IOI16_railroad)C++17
11 / 100
2070 ms9160 KiB
#include "railroad.h" #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define pii pair<int, int> #define ff first #define ss second pii a[200100]; long long plan_roller_coaster(vector<int> s, vector<int> t) { int n = s.size(); vector<int> q; for(int i=1; i<=n; i++){ a[i] = {t[i-1], s[i-1]}; q.pb(i); } ll ans = 1e18; do{ ll res = 0; for(int i=1; i<n; i++){ pii x = a[q[i-1]], y = a[q[i]]; res += max(x.ff - y.ss, 0); } ans = min(ans, res); }while(next_permutation(q.begin(), q.end())); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...