#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) r++;
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
n = 2 |
2 |
Correct |
3 ms |
384 KB |
n = 2 |
3 |
Correct |
2 ms |
256 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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
n = 2 |
2 |
Correct |
3 ms |
384 KB |
n = 2 |
3 |
Correct |
2 ms |
256 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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
569 ms |
23896 KB |
n = 199999 |
2 |
Correct |
563 ms |
23664 KB |
n = 199991 |
3 |
Correct |
478 ms |
23792 KB |
n = 199993 |
4 |
Correct |
419 ms |
18512 KB |
n = 152076 |
5 |
Correct |
230 ms |
12024 KB |
n = 93249 |
6 |
Correct |
504 ms |
20312 KB |
n = 199910 |
7 |
Correct |
431 ms |
23556 KB |
n = 199999 |
8 |
Correct |
410 ms |
20568 KB |
n = 199997 |
9 |
Correct |
499 ms |
20572 KB |
n = 171294 |
10 |
Correct |
421 ms |
17216 KB |
n = 140872 |
11 |
Incorrect |
522 ms |
20704 KB |
answer is not correct: 0 instead of 1 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
n = 2 |
2 |
Correct |
3 ms |
384 KB |
n = 2 |
3 |
Correct |
2 ms |
256 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 |
- |