Submission #261691

#TimeUsernameProblemLanguageResultExecution timeMemory
261691amallaRoller Coaster Railroad (IOI16_railroad)C++17
0 / 100
2065 ms8840 KiB
#include "railroad.h" #include<bits/stdc++.h> using namespace std; long long plan_roller_coaster(vector<int> s, vector<int> t) { long long n = (long long) s.size(); int ans = 1<<30; vector<pair<int,int> > S(n); for (int i = 1; i<=n; ++i) { S[i].first = s[i]; S[i].second = t[i]; } do { int need = 0; for (int i = 1; i<n; ++i) { if (S[i-1].second>S[i].first) need += S[i-1].second-S[i].first; } ans = min(need, ans); } while(next_permutation(S.begin(), S.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...