#include <bits/stdc++.h>
using namespace std;
#include "railroad.h"
const int MAX = 2e5;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
int n = (int) s.size();
map<int, int> interest;
interest[1]--;
for (int i = 0; i < n; i++) {
interest[s[i]]++;
interest[t[i]]--;
}
long long value = 0;
long long balance = 0;
for (pair<int, int> p : interest)
{
value += p.second;
balance += max((long long)0, value);
}
return balance;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
n = 2 |
2 |
Correct |
1 ms |
292 KB |
n = 2 |
3 |
Correct |
1 ms |
204 KB |
n = 2 |
4 |
Correct |
1 ms |
204 KB |
n = 2 |
5 |
Correct |
1 ms |
204 KB |
n = 2 |
6 |
Incorrect |
1 ms |
204 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
n = 2 |
2 |
Correct |
1 ms |
292 KB |
n = 2 |
3 |
Correct |
1 ms |
204 KB |
n = 2 |
4 |
Correct |
1 ms |
204 KB |
n = 2 |
5 |
Correct |
1 ms |
204 KB |
n = 2 |
6 |
Incorrect |
1 ms |
204 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
442 ms |
26072 KB |
n = 199999 |
2 |
Correct |
429 ms |
25968 KB |
n = 199991 |
3 |
Correct |
449 ms |
26120 KB |
n = 199993 |
4 |
Correct |
285 ms |
19504 KB |
n = 152076 |
5 |
Correct |
129 ms |
12264 KB |
n = 93249 |
6 |
Correct |
327 ms |
21508 KB |
n = 199910 |
7 |
Correct |
322 ms |
24820 KB |
n = 199999 |
8 |
Correct |
302 ms |
21572 KB |
n = 199997 |
9 |
Correct |
325 ms |
22104 KB |
n = 171294 |
10 |
Correct |
251 ms |
18372 KB |
n = 140872 |
11 |
Incorrect |
317 ms |
21684 KB |
answer is not correct: 0 instead of 1 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
n = 2 |
2 |
Correct |
1 ms |
292 KB |
n = 2 |
3 |
Correct |
1 ms |
204 KB |
n = 2 |
4 |
Correct |
1 ms |
204 KB |
n = 2 |
5 |
Correct |
1 ms |
204 KB |
n = 2 |
6 |
Incorrect |
1 ms |
204 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |