Submission #58449

# Submission time Handle Problem Language Result Execution time Memory
58449 2018-07-17T21:02:59 Z reality Ancient Books (IOI17_books) C++17
50 / 100
322 ms 66892 KB
#include "books.h"
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
#include "books.h"
long long minimum_walk(std::vector<int> p, int s) {
	int n = p.size();
	ll ans = -2;
	while (!p.empty() && p.back() == n - 1)
		--n,p.pop_back();
	if (!n)
		return 0;
	for (int i = 0;i < n;++i)
		ans += abs(i - p[i]);
	int mx = 0;
	for (int i = 0;i < n;++i)
		smax(mx,p[i]),ans += 2 * (i == mx);
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 488 KB Output is correct
3 Correct 3 ms 488 KB Output is correct
4 Correct 2 ms 488 KB Output is correct
5 Correct 3 ms 488 KB Output is correct
6 Correct 5 ms 488 KB Output is correct
7 Correct 3 ms 520 KB Output is correct
8 Correct 4 ms 576 KB Output is correct
9 Correct 3 ms 576 KB Output is correct
10 Correct 2 ms 576 KB Output is correct
11 Correct 2 ms 576 KB Output is correct
12 Correct 2 ms 576 KB Output is correct
13 Correct 2 ms 576 KB Output is correct
14 Correct 3 ms 576 KB Output is correct
15 Correct 2 ms 576 KB Output is correct
16 Correct 2 ms 576 KB Output is correct
17 Correct 3 ms 576 KB Output is correct
18 Correct 3 ms 576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 488 KB Output is correct
3 Correct 3 ms 488 KB Output is correct
4 Correct 2 ms 488 KB Output is correct
5 Correct 3 ms 488 KB Output is correct
6 Correct 5 ms 488 KB Output is correct
7 Correct 3 ms 520 KB Output is correct
8 Correct 4 ms 576 KB Output is correct
9 Correct 3 ms 576 KB Output is correct
10 Correct 2 ms 576 KB Output is correct
11 Correct 2 ms 576 KB Output is correct
12 Correct 2 ms 576 KB Output is correct
13 Correct 2 ms 576 KB Output is correct
14 Correct 3 ms 576 KB Output is correct
15 Correct 2 ms 576 KB Output is correct
16 Correct 2 ms 576 KB Output is correct
17 Correct 3 ms 576 KB Output is correct
18 Correct 3 ms 576 KB Output is correct
19 Correct 3 ms 576 KB Output is correct
20 Correct 3 ms 576 KB Output is correct
21 Correct 2 ms 576 KB Output is correct
22 Correct 3 ms 576 KB Output is correct
23 Correct 2 ms 576 KB Output is correct
24 Correct 3 ms 576 KB Output is correct
25 Correct 3 ms 576 KB Output is correct
26 Correct 3 ms 576 KB Output is correct
27 Correct 3 ms 608 KB Output is correct
28 Correct 3 ms 616 KB Output is correct
29 Correct 3 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 488 KB Output is correct
3 Correct 3 ms 488 KB Output is correct
4 Correct 2 ms 488 KB Output is correct
5 Correct 3 ms 488 KB Output is correct
6 Correct 5 ms 488 KB Output is correct
7 Correct 3 ms 520 KB Output is correct
8 Correct 4 ms 576 KB Output is correct
9 Correct 3 ms 576 KB Output is correct
10 Correct 2 ms 576 KB Output is correct
11 Correct 2 ms 576 KB Output is correct
12 Correct 2 ms 576 KB Output is correct
13 Correct 2 ms 576 KB Output is correct
14 Correct 3 ms 576 KB Output is correct
15 Correct 2 ms 576 KB Output is correct
16 Correct 2 ms 576 KB Output is correct
17 Correct 3 ms 576 KB Output is correct
18 Correct 3 ms 576 KB Output is correct
19 Correct 3 ms 576 KB Output is correct
20 Correct 3 ms 576 KB Output is correct
21 Correct 2 ms 576 KB Output is correct
22 Correct 3 ms 576 KB Output is correct
23 Correct 2 ms 576 KB Output is correct
24 Correct 3 ms 576 KB Output is correct
25 Correct 3 ms 576 KB Output is correct
26 Correct 3 ms 576 KB Output is correct
27 Correct 3 ms 608 KB Output is correct
28 Correct 3 ms 616 KB Output is correct
29 Correct 3 ms 620 KB Output is correct
30 Correct 186 ms 15216 KB Output is correct
31 Correct 322 ms 21900 KB Output is correct
32 Correct 145 ms 28724 KB Output is correct
33 Correct 156 ms 35244 KB Output is correct
34 Correct 308 ms 42016 KB Output is correct
35 Correct 147 ms 48744 KB Output is correct
36 Correct 154 ms 55472 KB Output is correct
37 Correct 192 ms 62328 KB Output is correct
38 Correct 190 ms 66792 KB Output is correct
39 Correct 185 ms 66892 KB Output is correct
40 Correct 188 ms 66892 KB Output is correct
41 Correct 195 ms 66892 KB Output is correct
42 Correct 162 ms 66892 KB Output is correct
43 Correct 254 ms 66892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 66892 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 3 ms 376 KB Output is correct
2 Correct 3 ms 488 KB Output is correct
3 Correct 3 ms 488 KB Output is correct
4 Correct 2 ms 488 KB Output is correct
5 Correct 3 ms 488 KB Output is correct
6 Correct 5 ms 488 KB Output is correct
7 Correct 3 ms 520 KB Output is correct
8 Correct 4 ms 576 KB Output is correct
9 Correct 3 ms 576 KB Output is correct
10 Correct 2 ms 576 KB Output is correct
11 Correct 2 ms 576 KB Output is correct
12 Correct 2 ms 576 KB Output is correct
13 Correct 2 ms 576 KB Output is correct
14 Correct 3 ms 576 KB Output is correct
15 Correct 2 ms 576 KB Output is correct
16 Correct 2 ms 576 KB Output is correct
17 Correct 3 ms 576 KB Output is correct
18 Correct 3 ms 576 KB Output is correct
19 Correct 3 ms 576 KB Output is correct
20 Correct 3 ms 576 KB Output is correct
21 Correct 2 ms 576 KB Output is correct
22 Correct 3 ms 576 KB Output is correct
23 Correct 2 ms 576 KB Output is correct
24 Correct 3 ms 576 KB Output is correct
25 Correct 3 ms 576 KB Output is correct
26 Correct 3 ms 576 KB Output is correct
27 Correct 3 ms 608 KB Output is correct
28 Correct 3 ms 616 KB Output is correct
29 Correct 3 ms 620 KB Output is correct
30 Correct 186 ms 15216 KB Output is correct
31 Correct 322 ms 21900 KB Output is correct
32 Correct 145 ms 28724 KB Output is correct
33 Correct 156 ms 35244 KB Output is correct
34 Correct 308 ms 42016 KB Output is correct
35 Correct 147 ms 48744 KB Output is correct
36 Correct 154 ms 55472 KB Output is correct
37 Correct 192 ms 62328 KB Output is correct
38 Correct 190 ms 66792 KB Output is correct
39 Correct 185 ms 66892 KB Output is correct
40 Correct 188 ms 66892 KB Output is correct
41 Correct 195 ms 66892 KB Output is correct
42 Correct 162 ms 66892 KB Output is correct
43 Correct 254 ms 66892 KB Output is correct
44 Incorrect 2 ms 66892 KB 3rd lines differ - on the 1st token, expected: '3304', found: '2744'
45 Halted 0 ms 0 KB -