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"
#define pii pair<int,int>
#define MP make_pair
#define PB push_back
#define ft first
#define sd second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
using namespace std;
const int oo = int(1e9) + 1;
vector<pii> vc;
int n;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
n = (int) s.size();
vc.PB(MP(1, -1));
vc.PB(MP(oo, +1));
for (int i = 0; i < n; i++)
if (s[i] < t[i]){
vc.PB(MP(s[i], +1));
vc.PB(MP(t[i], -1));
} else {
vc.PB(MP(s[i], -1));
vc.PB(MP(t[i], +1));
}
sort(all(vc));
int sm = 0;
for (int i = 0; i < sz(vc); ){
if (sm > 0) return 1;
int j = i;
while (j < sz(vc) && vc[i].ft == vc[j].ft){
sm += vc[j].sd;
j++;
}
i = j;
}
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... |