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>
#ifndef ARTHUR_LOCAL
#include "railroad.h"
#endif
using namespace std;
using ll=long long;
const int MAXN = 200000;
ll plan_roller_coaster(vector<int> s, vector<int> t)
{
int n = s.size();
vector<pair<int,int>> ST;
for(int i=0; i<n; i++)
{
ST.push_back({s[i],t[i]});
}
sort(ST.begin(),ST.end());
vector<int> vals;
for(int i=0; i<n; i++)
{
int k = lower_bound(ST.begin(),ST.end(),make_pair(ST[i].second,0)) - ST.begin();
// if(TS[0].first > TS[i].second) vals.push_back(-1);
vals.push_back(k);
}
sort(vals.begin(),vals.end());
int offences=0;
for(int i=0; i<n; i++)
{
// cout << i << " " << vals[i] << endl;
if(vals[i] > i) offences++;
}
if(offences>1) return 1;
return 0;
}
#ifdef ARTHUR_LOCAL
int main()
{
plan_roller_coaster({10,10,10},{2,1,3});
}
#endif
# | 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... |