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;
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 1e5+10;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9+7;
long long plan_roller_coaster(vector<int> s, vector<int> t) {
vector<int> arr;
for(auto u : s) arr.pb(u);
for(auto u : t) arr.pb(u);
sort(all(arr));
arr.erase(unique(all(arr)), arr.end());
int n=(int)arr.size();
map<int, int> mp;
vector<int> g(n, 0);
for(int i=0;i<n;i++) mp[arr[i]]=i;
g[n-1]++; g[0]--;
for(int i=0;i<(int)s.size();i++){
g[mp[s[i]]]++; g[mp[t[i]]]--;
}
int tot=0;
for(int i=n-1;i>=0;i--){
if(tot+g[i]<0) return 1;
tot+=g[i];
}
//if(tot) 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... |