Submission #293683

#TimeUsernameProblemLanguageResultExecution timeMemory
293683VodkaInTheJarRoller Coaster Railroad (IOI16_railroad)C++14
0 / 100
214 ms29824 KiB
#include <bits/stdc++.h> #include "railroad.h" using namespace std; const long long inf = 1e18; long long plan_roller_coaster(vector <int> s, vector <int> t) { int n = (int)s.size(); long long ans = inf; for (int i = 0; i < n; i++) { multiset <pair <int, int> > se; for (int j = 0; j < n; j++) if (j != i) se.insert({s[j], t[j]}); long long curr_ans = 0; int curr_t = t[i]; while (!s.empty()) { auto it = se.lower_bound({curr_t, 0}); if (it == se.end()) it--; curr_ans += max(0, curr_t - it->first); curr_t = it->second; se.erase(it); } ans = min(ans, curr_ans); } 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...