# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
73004 | Kmcode | Roller Coaster Railroad (IOI16_railroad) | C++14 | 167 ms | 7756 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>
using namespace std;
//#include "railroad.h"
vector<pair<int,int> > v;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
int n = (int) s.size();
for(int i=0;i<n;i++){
v.push_back(make_pair(s[i],1));
v.push_back(make_pair(t[i],0));
}
sort(v.begin(),v.end());
reverse(v.begin(),v.end());
bool ok=false;
int stk=0;
int en=0;
for(int i=0;i<v.size();i++){
if(v[i].second==1){
stk++;
}
else{
if(stk){
stk--;
continue;
}
if(stk==0){
if(en==0){
en=1;
break;
}
ok=true;
break;
}
}
}
return ok;
}
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... |