#include <bits/stdc++.h>
#include "railroad.h"
using namespace std;
#define ll long long
map <int, int> m;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
s.push_back(1e9);
t.push_back(1);
int n = s.size();
for(int i = 0 ; i < n ; i++){
int l = s[i], r = t[i];
if(l > r) swap(l, r);
if(l == r) assert(false);
if(s[i] < t[i]) m[l]++, m[r]--;
else m[l]--, m[r]++;
}
int sum = 0;
for(auto &i : m){
sum += i.second;
if(sum > 0) return 1;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
n = 2 |
2 |
Correct |
2 ms |
256 KB |
n = 2 |
3 |
Correct |
2 ms |
384 KB |
n = 2 |
4 |
Correct |
2 ms |
384 KB |
n = 2 |
5 |
Correct |
2 ms |
256 KB |
n = 2 |
6 |
Incorrect |
2 ms |
384 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
n = 2 |
2 |
Correct |
2 ms |
256 KB |
n = 2 |
3 |
Correct |
2 ms |
384 KB |
n = 2 |
4 |
Correct |
2 ms |
384 KB |
n = 2 |
5 |
Correct |
2 ms |
256 KB |
n = 2 |
6 |
Incorrect |
2 ms |
384 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
571 ms |
25064 KB |
n = 199999 |
2 |
Correct |
457 ms |
25044 KB |
n = 199991 |
3 |
Correct |
459 ms |
25072 KB |
n = 199993 |
4 |
Correct |
353 ms |
19592 KB |
n = 152076 |
5 |
Correct |
204 ms |
12312 KB |
n = 93249 |
6 |
Runtime error |
64 ms |
9944 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
n = 2 |
2 |
Correct |
2 ms |
256 KB |
n = 2 |
3 |
Correct |
2 ms |
384 KB |
n = 2 |
4 |
Correct |
2 ms |
384 KB |
n = 2 |
5 |
Correct |
2 ms |
256 KB |
n = 2 |
6 |
Incorrect |
2 ms |
384 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |