제출 #1061957

#제출 시각아이디문제언어결과실행 시간메모리
1061957Hectorungo_18Roller Coaster Railroad (IOI16_railroad)C++14
0 / 100
2007 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(aux < 0) break; } if(aux < 0) continue; 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...