# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
123597 | baqargam | Roller Coaster Railroad (IOI16_railroad) | C++14 | 131 ms | 13448 KiB |
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;
long long j,l,d[400005],g[100],bal;
vector<pair<int,int> >v;
long long plan_roller_coaster(vector<int> s, vector<int> t) {
int n = (int) s.size();
for(int i=1;i<=n;i++){
v.push_back({s[i-1],i});
v.push_back({t[i-1],-i});
}
sort(v.begin(),v.end());
for(int i=0;i<2*n;i++){
int id=v[i].second;
int val=v[i].first;
if(id>0)
{
id=-id;
if(d[id]==0)
bal--;
else
bal++;
d[id]=1;
}
else
{
if(d[id]==0)
bal++;
else
bal--;
d[id]=1;
}
if(bal>0) return 0;
}
return 1;
}
Compilation message (stderr)
# | 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... |