Submission #636912

#TimeUsernameProblemLanguageResultExecution timeMemory
636912tabrRoller Coaster Railroad (IOI16_railroad)C++17
30 / 100
621 ms26136 KiB
#include <bits/stdc++.h> using namespace std; #ifdef tabr #include "library/debug.cpp" #else #define debug(...) #endif long long plan_roller_coaster(vector<int> s, vector<int> t) { s.emplace_back((int) 1e9); t.emplace_back(1); int n = (int) s.size(); multiset<pair<int, int>> st, ts; for (int i = 0; i < n; i++) { st.emplace(s[i], t[i]); ts.emplace(t[i], s[i]); } while (st.size() > 1) { auto p = *ts.rbegin(); ts.erase(ts.find(p)); swap(p.first, p.second); st.erase(st.find(p)); auto q = *st.rbegin(); swap(q.first, q.second); ts.erase(ts.find(q)); swap(q.first, q.second); st.erase(st.find(q)); if (p.second > q.first) { return 1; } st.emplace(p.first, q.second); ts.emplace(q.second, p.first); } auto p = *st.begin(); if (p.first < p.second) { return 1; } else { return 0; } } #ifdef tabr int main() { ios::sync_with_stdio(false); cin.tie(0); debug(plan_roller_coaster({1, 4, 5, 6}, {7, 3, 8, 6})); return 0; } #endif
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...