#include <bits/stdc++.h>
#include "books.h"
using namespace std;
typedef long long ll;
const int MAXN = 1e6 + 10;
int n;
ll ans , ps[MAXN];
ll minimum_walk(vector<int> p, int s) {
n = p.size();
for(int i = 0 ; i < n ; i++){
ps[min(p[i] , i)]++;
ps[max(p[i] , i)]--;
}
partial_sum(ps , ps + MAXN , ps);
while(ps[n] == 0) n--;
for(int i = 0 ; i <= n ; i++){
ans += max(2ll , ps[i]);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
8012 KB |
Output is correct |
2 |
Correct |
6 ms |
8112 KB |
Output is correct |
3 |
Correct |
6 ms |
8012 KB |
Output is correct |
4 |
Correct |
6 ms |
8012 KB |
Output is correct |
5 |
Correct |
6 ms |
8012 KB |
Output is correct |
6 |
Correct |
6 ms |
8012 KB |
Output is correct |
7 |
Correct |
6 ms |
8072 KB |
Output is correct |
8 |
Correct |
6 ms |
8048 KB |
Output is correct |
9 |
Correct |
6 ms |
8012 KB |
Output is correct |
10 |
Correct |
6 ms |
8016 KB |
Output is correct |
11 |
Correct |
6 ms |
8012 KB |
Output is correct |
12 |
Correct |
6 ms |
8012 KB |
Output is correct |
13 |
Correct |
6 ms |
8012 KB |
Output is correct |
14 |
Correct |
6 ms |
8012 KB |
Output is correct |
15 |
Correct |
7 ms |
8012 KB |
Output is correct |
16 |
Correct |
6 ms |
8012 KB |
Output is correct |
17 |
Correct |
6 ms |
8012 KB |
Output is correct |
18 |
Correct |
6 ms |
8012 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
8012 KB |
Output is correct |
2 |
Correct |
6 ms |
8112 KB |
Output is correct |
3 |
Correct |
6 ms |
8012 KB |
Output is correct |
4 |
Correct |
6 ms |
8012 KB |
Output is correct |
5 |
Correct |
6 ms |
8012 KB |
Output is correct |
6 |
Correct |
6 ms |
8012 KB |
Output is correct |
7 |
Correct |
6 ms |
8072 KB |
Output is correct |
8 |
Correct |
6 ms |
8048 KB |
Output is correct |
9 |
Correct |
6 ms |
8012 KB |
Output is correct |
10 |
Correct |
6 ms |
8016 KB |
Output is correct |
11 |
Correct |
6 ms |
8012 KB |
Output is correct |
12 |
Correct |
6 ms |
8012 KB |
Output is correct |
13 |
Correct |
6 ms |
8012 KB |
Output is correct |
14 |
Correct |
6 ms |
8012 KB |
Output is correct |
15 |
Correct |
7 ms |
8012 KB |
Output is correct |
16 |
Correct |
6 ms |
8012 KB |
Output is correct |
17 |
Correct |
6 ms |
8012 KB |
Output is correct |
18 |
Correct |
6 ms |
8012 KB |
Output is correct |
19 |
Correct |
6 ms |
8008 KB |
Output is correct |
20 |
Correct |
6 ms |
8012 KB |
Output is correct |
21 |
Correct |
6 ms |
8116 KB |
Output is correct |
22 |
Correct |
6 ms |
8040 KB |
Output is correct |
23 |
Correct |
6 ms |
8012 KB |
Output is correct |
24 |
Correct |
6 ms |
8012 KB |
Output is correct |
25 |
Correct |
6 ms |
8012 KB |
Output is correct |
26 |
Correct |
6 ms |
8012 KB |
Output is correct |
27 |
Correct |
6 ms |
8108 KB |
Output is correct |
28 |
Correct |
6 ms |
8072 KB |
Output is correct |
29 |
Correct |
6 ms |
8012 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
8012 KB |
Output is correct |
2 |
Correct |
6 ms |
8112 KB |
Output is correct |
3 |
Correct |
6 ms |
8012 KB |
Output is correct |
4 |
Correct |
6 ms |
8012 KB |
Output is correct |
5 |
Correct |
6 ms |
8012 KB |
Output is correct |
6 |
Correct |
6 ms |
8012 KB |
Output is correct |
7 |
Correct |
6 ms |
8072 KB |
Output is correct |
8 |
Correct |
6 ms |
8048 KB |
Output is correct |
9 |
Correct |
6 ms |
8012 KB |
Output is correct |
10 |
Correct |
6 ms |
8016 KB |
Output is correct |
11 |
Correct |
6 ms |
8012 KB |
Output is correct |
12 |
Correct |
6 ms |
8012 KB |
Output is correct |
13 |
Correct |
6 ms |
8012 KB |
Output is correct |
14 |
Correct |
6 ms |
8012 KB |
Output is correct |
15 |
Correct |
7 ms |
8012 KB |
Output is correct |
16 |
Correct |
6 ms |
8012 KB |
Output is correct |
17 |
Correct |
6 ms |
8012 KB |
Output is correct |
18 |
Correct |
6 ms |
8012 KB |
Output is correct |
19 |
Correct |
6 ms |
8008 KB |
Output is correct |
20 |
Correct |
6 ms |
8012 KB |
Output is correct |
21 |
Correct |
6 ms |
8116 KB |
Output is correct |
22 |
Correct |
6 ms |
8040 KB |
Output is correct |
23 |
Correct |
6 ms |
8012 KB |
Output is correct |
24 |
Correct |
6 ms |
8012 KB |
Output is correct |
25 |
Correct |
6 ms |
8012 KB |
Output is correct |
26 |
Correct |
6 ms |
8012 KB |
Output is correct |
27 |
Correct |
6 ms |
8108 KB |
Output is correct |
28 |
Correct |
6 ms |
8072 KB |
Output is correct |
29 |
Correct |
6 ms |
8012 KB |
Output is correct |
30 |
Correct |
148 ms |
15868 KB |
Output is correct |
31 |
Correct |
146 ms |
15864 KB |
Output is correct |
32 |
Correct |
151 ms |
15852 KB |
Output is correct |
33 |
Correct |
135 ms |
15868 KB |
Output is correct |
34 |
Correct |
137 ms |
15864 KB |
Output is correct |
35 |
Correct |
135 ms |
15856 KB |
Output is correct |
36 |
Correct |
139 ms |
15860 KB |
Output is correct |
37 |
Correct |
135 ms |
15940 KB |
Output is correct |
38 |
Correct |
136 ms |
15868 KB |
Output is correct |
39 |
Correct |
134 ms |
15864 KB |
Output is correct |
40 |
Correct |
134 ms |
15940 KB |
Output is correct |
41 |
Correct |
138 ms |
15856 KB |
Output is correct |
42 |
Correct |
137 ms |
15940 KB |
Output is correct |
43 |
Correct |
135 ms |
15872 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
8016 KB |
3rd lines differ - on the 1st token, expected: '3304', found: '2744' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
8012 KB |
Output is correct |
2 |
Correct |
6 ms |
8112 KB |
Output is correct |
3 |
Correct |
6 ms |
8012 KB |
Output is correct |
4 |
Correct |
6 ms |
8012 KB |
Output is correct |
5 |
Correct |
6 ms |
8012 KB |
Output is correct |
6 |
Correct |
6 ms |
8012 KB |
Output is correct |
7 |
Correct |
6 ms |
8072 KB |
Output is correct |
8 |
Correct |
6 ms |
8048 KB |
Output is correct |
9 |
Correct |
6 ms |
8012 KB |
Output is correct |
10 |
Correct |
6 ms |
8016 KB |
Output is correct |
11 |
Correct |
6 ms |
8012 KB |
Output is correct |
12 |
Correct |
6 ms |
8012 KB |
Output is correct |
13 |
Correct |
6 ms |
8012 KB |
Output is correct |
14 |
Correct |
6 ms |
8012 KB |
Output is correct |
15 |
Correct |
7 ms |
8012 KB |
Output is correct |
16 |
Correct |
6 ms |
8012 KB |
Output is correct |
17 |
Correct |
6 ms |
8012 KB |
Output is correct |
18 |
Correct |
6 ms |
8012 KB |
Output is correct |
19 |
Correct |
6 ms |
8008 KB |
Output is correct |
20 |
Correct |
6 ms |
8012 KB |
Output is correct |
21 |
Correct |
6 ms |
8116 KB |
Output is correct |
22 |
Correct |
6 ms |
8040 KB |
Output is correct |
23 |
Correct |
6 ms |
8012 KB |
Output is correct |
24 |
Correct |
6 ms |
8012 KB |
Output is correct |
25 |
Correct |
6 ms |
8012 KB |
Output is correct |
26 |
Correct |
6 ms |
8012 KB |
Output is correct |
27 |
Correct |
6 ms |
8108 KB |
Output is correct |
28 |
Correct |
6 ms |
8072 KB |
Output is correct |
29 |
Correct |
6 ms |
8012 KB |
Output is correct |
30 |
Correct |
148 ms |
15868 KB |
Output is correct |
31 |
Correct |
146 ms |
15864 KB |
Output is correct |
32 |
Correct |
151 ms |
15852 KB |
Output is correct |
33 |
Correct |
135 ms |
15868 KB |
Output is correct |
34 |
Correct |
137 ms |
15864 KB |
Output is correct |
35 |
Correct |
135 ms |
15856 KB |
Output is correct |
36 |
Correct |
139 ms |
15860 KB |
Output is correct |
37 |
Correct |
135 ms |
15940 KB |
Output is correct |
38 |
Correct |
136 ms |
15868 KB |
Output is correct |
39 |
Correct |
134 ms |
15864 KB |
Output is correct |
40 |
Correct |
134 ms |
15940 KB |
Output is correct |
41 |
Correct |
138 ms |
15856 KB |
Output is correct |
42 |
Correct |
137 ms |
15940 KB |
Output is correct |
43 |
Correct |
135 ms |
15872 KB |
Output is correct |
44 |
Incorrect |
6 ms |
8016 KB |
3rd lines differ - on the 1st token, expected: '3304', found: '2744' |
45 |
Halted |
0 ms |
0 KB |
- |