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<set>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define fs first
#define sn second
#define mp make_pair
#define ll long long
#define N 202300
using namespace std;
int n,x,now;
set<pair<int,int> >st;
set<pair<int,int> >::iterator it;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
n = s.size();
x=0;
for(int i=1;i<n;++i)
if(t[i]>t[x])x=i;
for(int i=0;i<n;++i)
if(x!=i)
st.insert(mp(s[i],i));
now=1;
for(int i=0;i<n-1;++i){
it=st.lower_bound(mp(now,0));
if(it==st.end())return 1;
now=t[(*it).sn];
st.erase(it);
}
if(now<=s[x])return 0;
else return 1;
}
# | 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... |