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>> TS;
for(int i=0; i<n; i++)
{
TS.push_back({t[i],s[i]});
}
sort(TS.begin(),TS.end());
vector<int> vals;
for(int i=0; i<n; i++)
{
int k = lower_bound(TS.begin(),TS.end(),make_pair(TS[i].second,0)) - TS.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++)
{
if(vals[i] > i) offences++;
}
if(offences>1) 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... |