Submission #1061955

#TimeUsernameProblemLanguageResultExecution timeMemory
1061955Hectorungo_18Roller Coaster Railroad (IOI16_railroad)C++14
0 / 100
2070 ms6612 KiB
#include <bits/stdc++.h> using namespace std; // #define int long long long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { int n = s.size(); vector<pair<int, int>> v(n); for(int i = 0; i < n; i++){ v[i]={s[i], t[i]}; } sort(v.begin(), v.end()); vector<pair<int, int>> sol; int ans = 1e9+7; do{ int ex = 1; int aux = 0; for(int i = 0; i < n; i++){ if(ex <= v[i].first){ ex = v[i].second; continue; } aux+=ex-v[i].first; } if(ans > aux){ ans = aux; sol = v; } } while(next_permutation(v.begin(), v.end())); // cout << ans << endl; // for(auto x : sol){ // cout << x.first << " " << x.second << endl;; // } 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...