제출 #261696

#제출 시각아이디문제언어결과실행 시간메모리
261696amallaRoller Coaster Railroad (IOI16_railroad)C++17
0 / 100
2051 ms6732 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; long long plan_roller_coaster(vector<int> s, vector<int> t) { ll n = (ll) s.size(), ans = 100000000000000; vector<pair<ll, ll> > S(n); for (int i = 0; i<n; ++i) { S[i].first = s[i]; S[i].second = t[i]; } do { ll 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...