# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
88592 | amiratou | Roller Coaster Railroad (IOI16_railroad) | C++14 | 227 ms | 25700 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;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define fi first
#define se second
#define ll long long
#define ii pair<int,int>
#define v vector<int>
#define vv vector<vector<int> >
#define pb push_back
#define INF LLONG_MAX
using namespace std;
set<pair<int,int> > myset;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
int n = (int) s.size();
int maxi,maxval=0,mini,minval=INT_MAX;
for (int i = 0; i < n; ++i)
{
myset.insert({s[i],i});
if(minval>s[i]){
minval=s[i];
mini=i;
}
if(maxval<t[i]){
maxval=t[i];
maxi=i;
}
}
if(maxi==mini){
auto temp=myset.begin();
temp++;
mini=temp->se;
}
myset.erase(myset.find({s[mini],mini}));
int curr=t[mini];
while(!myset.empty()){
auto search=myset.lower_bound({curr,0});
if(search==myset.end()&&search->fi!=curr)return INF-5;
if(search->fi!=curr)
search++;
curr=t[search->se];
myset.erase(search);
}
return 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... |