Submission #617131

#TimeUsernameProblemLanguageResultExecution timeMemory
617131Drew_Roller Coaster Railroad (IOI16_railroad)C++17
0 / 100
250 ms13384 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #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; namespace sub1 { void solve(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())); } }; ll plan_roller_coaster(vector<int> s, vector<int> t) { int n = size(s); set<ii> st; for (int i = 0; i < n; ++i) st.insert({t[i], s[i]}); for (int prv = 1e9; !st.empty();) { auto it = st.lower_bound(mp(prv, 1e9)); if (it == st.begin()) return 1; it = prev(it); prv = (it -> s2); st.erase(it); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...