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;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t)
{
#define int long long
int n = (int)s.size();
vector<pair<int, int>> ss, tt;
for(int i=0;i<n;i++)
{
tt.push_back({t[i], i});
ss.push_back({s[i], i});
}
sort(ss.rbegin(), ss.rend());
sort(tt.rbegin(), tt.rend());
int i = 0, j = 1;
while(i < n)
{
if(ss[i].second != tt[j].second)
{
if(tt[j].first > ss[i].first)
return 999;
}
else if(i != 0)
{
if(tt[j].first > ss[i - 1].first)
return 999;
}
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... |