Submission #1042653

#TimeUsernameProblemLanguageResultExecution timeMemory
1042653ZicrusRoller Coaster Railroad (IOI16_railroad)C++17
11 / 100
2096 ms6744 KiB
#include <bits/stdc++.h> #include "railroad.h" using namespace std; typedef long long ll; ll plan_roller_coaster(vector<int> s, vector<int> t) { ll n = s.size(); vector<pair<ll, ll>> a(n); for (int i = 0; i < n; i++) { a[i] = {s[i], t[i]}; } sort(a.begin(), a.end()); ll res = 1ll << 62ll; do { ll val = 0; for (int i = 1; i < n; i++) { val += max(0ll, a[i-1].second - a[i].first); } res = min(res, val); } while (next_permutation(a.begin(), a.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...