#include "railroad.h"
#include<set>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define fs first
#define sn second
#define mp make_pair
#define ll long long
#define N 202300
using namespace std;
int n,x,now;
set<pair<int,int> >st;
set<pair<int,int> >::iterator it;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
n = s.size();
x=0;
for(int i=1;i<n;++i)
if(t[i]>t[x])x=i;
for(int i=0;i<n;++i)
if(x!=i)
st.insert(mp(s[i],i));
now=1;
for(int i=0;i<n-1;++i){
it=st.lower_bound(mp(now,0));
if(it==st.end())return 1;
now=t[(*it).sn];
st.erase(it);
}
if(now<=s[x])return 0;
else return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
n = 2 |
2 |
Correct |
0 ms |
296 KB |
n = 2 |
3 |
Correct |
1 ms |
212 KB |
n = 2 |
4 |
Correct |
1 ms |
212 KB |
n = 2 |
5 |
Correct |
1 ms |
300 KB |
n = 2 |
6 |
Incorrect |
1 ms |
212 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
n = 2 |
2 |
Correct |
0 ms |
296 KB |
n = 2 |
3 |
Correct |
1 ms |
212 KB |
n = 2 |
4 |
Correct |
1 ms |
212 KB |
n = 2 |
5 |
Correct |
1 ms |
300 KB |
n = 2 |
6 |
Incorrect |
1 ms |
212 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
115 ms |
15168 KB |
n = 199999 |
2 |
Correct |
139 ms |
15064 KB |
n = 199991 |
3 |
Correct |
89 ms |
15072 KB |
n = 199993 |
4 |
Correct |
83 ms |
12060 KB |
n = 152076 |
5 |
Incorrect |
55 ms |
7448 KB |
answer is not correct: 1 instead of 0 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
n = 2 |
2 |
Correct |
0 ms |
296 KB |
n = 2 |
3 |
Correct |
1 ms |
212 KB |
n = 2 |
4 |
Correct |
1 ms |
212 KB |
n = 2 |
5 |
Correct |
1 ms |
300 KB |
n = 2 |
6 |
Incorrect |
1 ms |
212 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |