Submission #1018176

#TimeUsernameProblemLanguageResultExecution timeMemory
1018176woodRoller Coaster Railroad (IOI16_railroad)C++17
0 / 100
2066 ms7628 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; #define eb emplace_back #define fi first #define se second typedef long long ll; typedef pair<ll,ll> p32; long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { ll res = LLONG_MAX; ll n = (int) s.size(); vector<p32> arr; for(int i = 0; i<n; i++){ arr.eb(s[i],t[i]); } do{ ll cost = 0; for(int i = 1; i<n; i++){ cost +=max(0LL,arr[i-1].se-arr[i].fi); } res = min(res,cost); }while(next_permutation(arr.begin(),arr.end())); return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...