# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1136956 | owoovo | Roller Coaster Railroad (IOI16_railroad) | C++20 | 157 ms | 19116 KiB |
#include "railroad.h"
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
using namespace std;
const ll maxn=1e18;
long long plan_roller_coaster(vector<int> s, vector<int> t) {
int n = (int) s.size();
ll ans=0;
vector<pair<ll,ll>> vc;
multiset<pair<ll,ll>> ms;
for(int i=0;i<n;i++){
vc.push_back({t[i],s[i]});
}
sort(vc.begin(),vc.end());
reverse(vc.begin(),vc.end());
for(int i=1;i<n;i++){
ms.insert(vc[i]);
}
ll now=vc[0].S;
while(ms.size()){
auto x=ms.upper_bound({now,maxn});
if(x==ms.begin())return 1;
auto use=x;
use--;
now=(*use).S;
ms.erase(use);
}
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... |