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 int long long
int plan_roller_coaster(std::vector<int32_t> s, std::vector<int32_t> t) {
int n = (int) s.size();
int INF=10000000000000007;
vector<int> S1;
vector<int> S2;
for (int i=0; i<n; i++) {
S1.push_back(s[i]);
S2.push_back(t[i]);
}
sort(S1.begin(), S1.end());
sort(S2.begin(), S2.end());
int fail=0;
for (int i=0; i<n; i++) {
int ind=(upper_bound(S2.begin(), S2.end(),(S1[i]))-S2.begin());
int i1=(upper_bound(S1.begin(), S1.end(), (S1[i]))-S1.begin());
if (ind>i1+1) {
fail=1;
}
}
for (int i=0; i<n; i++) {
int ind=(upper_bound(S2.begin(), S2.end(),(S1[i]-1))-S2.begin());
int i1=(upper_bound(S1.begin(), S1.end(), (S1[i]-1))-S1.begin());
if (ind>i1+1) {
fail=1;
}
}
return fail;
}
Compilation message (stderr)
railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:8:9: warning: unused variable 'INF' [-Wunused-variable]
8 | int INF=10000000000000007;
| ^~~
# | 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... |