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 <bits/stdc++.h>
using namespace std;
const int N = 200010;
vector< pair< int , int > > arr;
int sum[N];
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++){
arr.push_back(make_pair(s[i] , i));
}
sort(arr.begin(),arr.end());
for(int idx , i = 0 ;i < n;i++){
idx = lower_bound(arr.begin(),arr.end(),make_pair(t[i] , 0)) - arr.begin();
sum[idx]++;
}
int all = 0;
vector< int > cur;
for(int i = 0 ;i < n;i++){
all += sum[i];
if(t[arr[i].second] <= s[arr[i].second])
cur.push_back(all - 1);
else
cur.push_back(all);
}
sort(cur.begin(),cur.end());
for(int i = 0 ;i < (int)cur.size();i++){
if(cur[i] < i)
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... |