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>
using namespace std;
//stolen from https://oj.uz/submission/600511. Testing to see whether it works or not.
typedef long long ll;
typedef unsigned long long ull;
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x) x.begin(), x.end()
const int M = 100007;
const ll inf = 1e9;
const ll INF = 1e18;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t){
int n = (int) s.size();
vector < pair <int,int> > v;
for(int i = 0; i < n; ++i) v.pb({t[i], s[i]});
sort(all(v));
set < pair <int,int> > rem;
for(int i = 0; i < n; ++i) rem.insert({v[i].S, i});
for(int i = 0; i < n - 1; ++i){
auto it = rem.lower_bound({v[i].F, -1});
if(it == rem.end()) return 1;
if((*it).S == i) ++it;
if(it == rem.end()) return 1;
rem.erase(it);
}
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... |