// Ignut
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18 + 123;
ll plan_roller_coaster(vector<int> s, vector<int> t) {
int n = s.size();
vector<int> vec(n, 0);
iota(vec.begin(), vec.end(), 0);
ll res = INF;
do {
int speed = 1;
ll ans = 0;
for (int i : vec) {
ans += max(0, speed - s[i]);
speed = t[i];
}
res = min(res, ans);
} while (next_permutation(vec.begin(), vec.end()));
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
n = 2 |
2 |
Correct |
1 ms |
348 KB |
n = 2 |
3 |
Correct |
0 ms |
436 KB |
n = 2 |
4 |
Correct |
0 ms |
436 KB |
n = 2 |
5 |
Correct |
1 ms |
348 KB |
n = 2 |
6 |
Correct |
1 ms |
348 KB |
n = 2 |
7 |
Correct |
0 ms |
348 KB |
n = 3 |
8 |
Correct |
1 ms |
344 KB |
n = 3 |
9 |
Correct |
1 ms |
348 KB |
n = 3 |
10 |
Correct |
1 ms |
348 KB |
n = 8 |
11 |
Correct |
1 ms |
344 KB |
n = 8 |
12 |
Correct |
1 ms |
348 KB |
n = 8 |
13 |
Correct |
1 ms |
348 KB |
n = 8 |
14 |
Correct |
1 ms |
600 KB |
n = 8 |
15 |
Correct |
1 ms |
348 KB |
n = 8 |
16 |
Correct |
1 ms |
348 KB |
n = 8 |
17 |
Correct |
1 ms |
424 KB |
n = 8 |
18 |
Correct |
1 ms |
348 KB |
n = 8 |
19 |
Correct |
0 ms |
348 KB |
n = 3 |
20 |
Correct |
0 ms |
348 KB |
n = 7 |
21 |
Correct |
1 ms |
348 KB |
n = 8 |
22 |
Correct |
1 ms |
348 KB |
n = 8 |
23 |
Correct |
1 ms |
348 KB |
n = 8 |
24 |
Correct |
1 ms |
348 KB |
n = 8 |
25 |
Correct |
1 ms |
348 KB |
n = 8 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
n = 2 |
2 |
Correct |
1 ms |
348 KB |
n = 2 |
3 |
Correct |
0 ms |
436 KB |
n = 2 |
4 |
Correct |
0 ms |
436 KB |
n = 2 |
5 |
Correct |
1 ms |
348 KB |
n = 2 |
6 |
Correct |
1 ms |
348 KB |
n = 2 |
7 |
Correct |
0 ms |
348 KB |
n = 3 |
8 |
Correct |
1 ms |
344 KB |
n = 3 |
9 |
Correct |
1 ms |
348 KB |
n = 3 |
10 |
Correct |
1 ms |
348 KB |
n = 8 |
11 |
Correct |
1 ms |
344 KB |
n = 8 |
12 |
Correct |
1 ms |
348 KB |
n = 8 |
13 |
Correct |
1 ms |
348 KB |
n = 8 |
14 |
Correct |
1 ms |
600 KB |
n = 8 |
15 |
Correct |
1 ms |
348 KB |
n = 8 |
16 |
Correct |
1 ms |
348 KB |
n = 8 |
17 |
Correct |
1 ms |
424 KB |
n = 8 |
18 |
Correct |
1 ms |
348 KB |
n = 8 |
19 |
Correct |
0 ms |
348 KB |
n = 3 |
20 |
Correct |
0 ms |
348 KB |
n = 7 |
21 |
Correct |
1 ms |
348 KB |
n = 8 |
22 |
Correct |
1 ms |
348 KB |
n = 8 |
23 |
Correct |
1 ms |
348 KB |
n = 8 |
24 |
Correct |
1 ms |
348 KB |
n = 8 |
25 |
Correct |
1 ms |
348 KB |
n = 8 |
26 |
Correct |
1 ms |
344 KB |
n = 8 |
27 |
Correct |
1 ms |
348 KB |
n = 8 |
28 |
Correct |
1 ms |
604 KB |
n = 8 |
29 |
Execution timed out |
2084 ms |
348 KB |
Time limit exceeded |
30 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2036 ms |
8020 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
n = 2 |
2 |
Correct |
1 ms |
348 KB |
n = 2 |
3 |
Correct |
0 ms |
436 KB |
n = 2 |
4 |
Correct |
0 ms |
436 KB |
n = 2 |
5 |
Correct |
1 ms |
348 KB |
n = 2 |
6 |
Correct |
1 ms |
348 KB |
n = 2 |
7 |
Correct |
0 ms |
348 KB |
n = 3 |
8 |
Correct |
1 ms |
344 KB |
n = 3 |
9 |
Correct |
1 ms |
348 KB |
n = 3 |
10 |
Correct |
1 ms |
348 KB |
n = 8 |
11 |
Correct |
1 ms |
344 KB |
n = 8 |
12 |
Correct |
1 ms |
348 KB |
n = 8 |
13 |
Correct |
1 ms |
348 KB |
n = 8 |
14 |
Correct |
1 ms |
600 KB |
n = 8 |
15 |
Correct |
1 ms |
348 KB |
n = 8 |
16 |
Correct |
1 ms |
348 KB |
n = 8 |
17 |
Correct |
1 ms |
424 KB |
n = 8 |
18 |
Correct |
1 ms |
348 KB |
n = 8 |
19 |
Correct |
0 ms |
348 KB |
n = 3 |
20 |
Correct |
0 ms |
348 KB |
n = 7 |
21 |
Correct |
1 ms |
348 KB |
n = 8 |
22 |
Correct |
1 ms |
348 KB |
n = 8 |
23 |
Correct |
1 ms |
348 KB |
n = 8 |
24 |
Correct |
1 ms |
348 KB |
n = 8 |
25 |
Correct |
1 ms |
348 KB |
n = 8 |
26 |
Correct |
1 ms |
344 KB |
n = 8 |
27 |
Correct |
1 ms |
348 KB |
n = 8 |
28 |
Correct |
1 ms |
604 KB |
n = 8 |
29 |
Execution timed out |
2084 ms |
348 KB |
Time limit exceeded |
30 |
Halted |
0 ms |
0 KB |
- |