#include <bits/stdc++.h>
#include "railroad.h"
using namespace std;
#define ll long long
const ll inf = 1e9 + 10;
ll plan_roller_coaster( vector<int> ini, vector<int> fim ){
int n = ini.size();
set<pair<int, int>> s;
vector<int> marc(n);
for( int i = 0; i < n; i++ ) s.insert({ ini[i], i });
s.insert({ inf, n });
int cur = s.begin()->second; s.erase(s.begin());
while( cur != n ){
auto [pos, viz] = *s.lower_bound({fim[cur], -1});
marc[cur] = true; s.erase({ pos, viz });
cur = viz;
}
for( int i = 0; i < n; i++ ) if( marc[i] == 0 ) return 1;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
n = 2 |
2 |
Correct |
0 ms |
348 KB |
n = 2 |
3 |
Correct |
0 ms |
348 KB |
n = 2 |
4 |
Correct |
0 ms |
348 KB |
n = 2 |
5 |
Correct |
0 ms |
348 KB |
n = 2 |
6 |
Incorrect |
0 ms |
348 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
n = 2 |
2 |
Correct |
0 ms |
348 KB |
n = 2 |
3 |
Correct |
0 ms |
348 KB |
n = 2 |
4 |
Correct |
0 ms |
348 KB |
n = 2 |
5 |
Correct |
0 ms |
348 KB |
n = 2 |
6 |
Incorrect |
0 ms |
348 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
108 ms |
13652 KB |
n = 199999 |
2 |
Correct |
138 ms |
17584 KB |
n = 199991 |
3 |
Correct |
95 ms |
17488 KB |
n = 199993 |
4 |
Correct |
105 ms |
13008 KB |
n = 152076 |
5 |
Correct |
70 ms |
8272 KB |
n = 93249 |
6 |
Correct |
152 ms |
16468 KB |
n = 199910 |
7 |
Correct |
109 ms |
16864 KB |
n = 199999 |
8 |
Correct |
147 ms |
16688 KB |
n = 199997 |
9 |
Correct |
125 ms |
14936 KB |
n = 171294 |
10 |
Incorrect |
78 ms |
12372 KB |
answer is not correct: 1 instead of 0 |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
n = 2 |
2 |
Correct |
0 ms |
348 KB |
n = 2 |
3 |
Correct |
0 ms |
348 KB |
n = 2 |
4 |
Correct |
0 ms |
348 KB |
n = 2 |
5 |
Correct |
0 ms |
348 KB |
n = 2 |
6 |
Incorrect |
0 ms |
348 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |