제출 #1061961

#제출 시각아이디문제언어결과실행 시간메모리
1061961Hectorungo_18Roller Coaster Railroad (IOI16_railroad)C++14
11 / 100
2095 ms6480 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; long long int ans = 1e18+7; do{ int ex = 1; long long 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; ex = v[i].second; 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...