Submission #55687

# Submission time Handle Problem Language Result Execution time Memory
55687 2018-07-08T15:14:11 Z minkank Ancient Books (IOI17_books) C++17
50 / 100
313 ms 35024 KB
#include <bits/stdc++.h>
#include "books.h"

using namespace std;

long long minimum_walk(vector<int> a, int s) {
	int n = a.size();
	while(n && a[n - 1] == n - 1) n--;
	long long ans = 0;
	for(int i = 0; i < n; ++i) ans += abs(i - a[i]);
	int R = 0;
	for(int i = 0; i < n - 1; ++i) {
		R = max(R, a[i]);
		if(i == R) ans += 2;
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 396 KB Output is correct
3 Correct 2 ms 544 KB Output is correct
4 Correct 3 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 2 ms 596 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 2 ms 596 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Correct 2 ms 596 KB Output is correct
12 Correct 3 ms 596 KB Output is correct
13 Correct 3 ms 596 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 3 ms 596 KB Output is correct
16 Correct 2 ms 596 KB Output is correct
17 Correct 2 ms 596 KB Output is correct
18 Correct 2 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 396 KB Output is correct
3 Correct 2 ms 544 KB Output is correct
4 Correct 3 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 2 ms 596 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 2 ms 596 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Correct 2 ms 596 KB Output is correct
12 Correct 3 ms 596 KB Output is correct
13 Correct 3 ms 596 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 3 ms 596 KB Output is correct
16 Correct 2 ms 596 KB Output is correct
17 Correct 2 ms 596 KB Output is correct
18 Correct 2 ms 596 KB Output is correct
19 Correct 2 ms 596 KB Output is correct
20 Correct 3 ms 596 KB Output is correct
21 Correct 2 ms 604 KB Output is correct
22 Correct 2 ms 604 KB Output is correct
23 Correct 2 ms 612 KB Output is correct
24 Correct 3 ms 612 KB Output is correct
25 Correct 3 ms 612 KB Output is correct
26 Correct 3 ms 612 KB Output is correct
27 Correct 3 ms 672 KB Output is correct
28 Correct 3 ms 672 KB Output is correct
29 Correct 4 ms 672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 396 KB Output is correct
3 Correct 2 ms 544 KB Output is correct
4 Correct 3 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 2 ms 596 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 2 ms 596 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Correct 2 ms 596 KB Output is correct
12 Correct 3 ms 596 KB Output is correct
13 Correct 3 ms 596 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 3 ms 596 KB Output is correct
16 Correct 2 ms 596 KB Output is correct
17 Correct 2 ms 596 KB Output is correct
18 Correct 2 ms 596 KB Output is correct
19 Correct 2 ms 596 KB Output is correct
20 Correct 3 ms 596 KB Output is correct
21 Correct 2 ms 604 KB Output is correct
22 Correct 2 ms 604 KB Output is correct
23 Correct 2 ms 612 KB Output is correct
24 Correct 3 ms 612 KB Output is correct
25 Correct 3 ms 612 KB Output is correct
26 Correct 3 ms 612 KB Output is correct
27 Correct 3 ms 672 KB Output is correct
28 Correct 3 ms 672 KB Output is correct
29 Correct 4 ms 672 KB Output is correct
30 Correct 205 ms 15208 KB Output is correct
31 Correct 220 ms 21936 KB Output is correct
32 Correct 165 ms 28740 KB Output is correct
33 Correct 173 ms 34908 KB Output is correct
34 Correct 313 ms 34908 KB Output is correct
35 Correct 203 ms 34908 KB Output is correct
36 Correct 159 ms 34908 KB Output is correct
37 Correct 151 ms 34908 KB Output is correct
38 Correct 144 ms 34908 KB Output is correct
39 Correct 144 ms 35024 KB Output is correct
40 Correct 155 ms 35024 KB Output is correct
41 Correct 205 ms 35024 KB Output is correct
42 Correct 183 ms 35024 KB Output is correct
43 Correct 155 ms 35024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 35024 KB 3rd lines differ - on the 1st token, expected: '3304', found: '2744'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 396 KB Output is correct
3 Correct 2 ms 544 KB Output is correct
4 Correct 3 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 2 ms 596 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 2 ms 596 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Correct 2 ms 596 KB Output is correct
12 Correct 3 ms 596 KB Output is correct
13 Correct 3 ms 596 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 3 ms 596 KB Output is correct
16 Correct 2 ms 596 KB Output is correct
17 Correct 2 ms 596 KB Output is correct
18 Correct 2 ms 596 KB Output is correct
19 Correct 2 ms 596 KB Output is correct
20 Correct 3 ms 596 KB Output is correct
21 Correct 2 ms 604 KB Output is correct
22 Correct 2 ms 604 KB Output is correct
23 Correct 2 ms 612 KB Output is correct
24 Correct 3 ms 612 KB Output is correct
25 Correct 3 ms 612 KB Output is correct
26 Correct 3 ms 612 KB Output is correct
27 Correct 3 ms 672 KB Output is correct
28 Correct 3 ms 672 KB Output is correct
29 Correct 4 ms 672 KB Output is correct
30 Correct 205 ms 15208 KB Output is correct
31 Correct 220 ms 21936 KB Output is correct
32 Correct 165 ms 28740 KB Output is correct
33 Correct 173 ms 34908 KB Output is correct
34 Correct 313 ms 34908 KB Output is correct
35 Correct 203 ms 34908 KB Output is correct
36 Correct 159 ms 34908 KB Output is correct
37 Correct 151 ms 34908 KB Output is correct
38 Correct 144 ms 34908 KB Output is correct
39 Correct 144 ms 35024 KB Output is correct
40 Correct 155 ms 35024 KB Output is correct
41 Correct 205 ms 35024 KB Output is correct
42 Correct 183 ms 35024 KB Output is correct
43 Correct 155 ms 35024 KB Output is correct
44 Incorrect 2 ms 35024 KB 3rd lines differ - on the 1st token, expected: '3304', found: '2744'
45 Halted 0 ms 0 KB -