Submission #616946

#TimeUsernameProblemLanguageResultExecution timeMemory
616946Drew_Roller Coaster Railroad (IOI16_railroad)C++17
11 / 100
2071 ms4936 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define f1 first #define s2 second #define size(x) (int)x.size() using ll = long long; using ii = pair<int, int>; const ll inf = 1e18 + 69; ll plan_roller_coaster(vector<int> s, vector<int> t) { int n = size(s); vector<ii> v(n); for (int i = 0; i < n; ++i) v[i] = {s[i], t[i]}; sort(v.begin(), v.end()); ll mn = inf; do { ll ctr = 0; for (int i = 0, cur = 1; i < n; ++i) { ctr += max(0, cur - v[i].f1); cur = v[i].s2; } mn = min(mn, ctr); } while (next_permutation(v.begin(), v.end())); return mn; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...