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>
#include "railroad.h"
using namespace std;
#define ll long long
map <int, int> m;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
s.push_back(1e9);
t.push_back(1);
int n = s.size();
for(int i = 0 ; i < n ; i++){
int l = s[i], r = t[i];
if(l > r) swap(l, r);
if(l == r) r++;
if(s[i] < t[i]) m[l]++, m[r]--;
else m[l]--, m[r]++;
}
int sum = 0;
for(auto &i : m){
sum += i.second;
if(sum > 0) 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... |