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 <bits/stdc++.h>
#include "railroad.h"
using namespace std;
#define ll long long
const ll inf = 1e9 + 10;
ll plan_roller_coaster( vector<int> ini, vector<int> fim ){
int n = ini.size();
set<pair<int, int>> s;
vector<int> marc(n);
for( int i = 0; i < n; i++ ) s.insert({ ini[i], i });
s.insert({ inf, n });
int cur = s.begin()->second; s.erase(s.begin());
while( cur != n ){
auto [pos, viz] = *s.lower_bound({fim[cur], -1});
marc[cur] = true; s.erase({ pos, viz });
cur = viz;
}
for( int i = 0; i < n; i++ ) if( marc[i] == 0 ) return 1;
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... |