This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "railroad.h"
#include <map>
#include <utility>
using namespace std;
multimap<int,int> R;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
int N = (int) s.size();
for (int i=0; i<N; i++) {
R.insert({t[i], s[i]});
}
R.insert({1, 1<<30});
while (R.size() > 1) {
pair<int,int> cur = *R.rbegin();
R.erase(--R.end());
auto it = --R.end();
while (true) {
if ((*it).second >= cur.first) {
int newt = (*it).first;
R.erase(it);
R.insert({newt, cur.second});
break;
} else if (it == R.begin()) {return(42069);}
--it;
}
}
return(0);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |