# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1031683 | pcc | Roller Coaster Railroad (IOI16_railroad) | C++17 | 111 ms | 7332 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 "railroad.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define fs first
#define sc second
#define pll pair<ll,ll>
#define _all(T) T.begin(),T.end()
//claim always can be connected
const ll inf = 1e18;
const int mxn = 2e5+10;
vector<int> all;
int deg[mxn*3];
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
int N = (int)s.size();
all.push_back(0);
for(auto &i:s)all.push_back(i);
for(auto &i:t)all.push_back(i);
sort(_all(all));all.resize(unique(_all(all))-all.begin());
for(auto &i:s)i = lower_bound(_all(all),i)-all.begin();
for(auto &i:t)i = lower_bound(_all(all),i)-all.begin();
s.push_back(all.size()-1);
t.push_back(1);
for(auto &i:t)deg[i]--;
for(auto &i:s)deg[i]++;
for(int i = all.size()-1;i>=0;i--){
deg[i] += deg[i+1];
}
return *min_element(deg,deg+all.size())<0;
}
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... |