Submission #55686

# Submission time Handle Problem Language Result Execution time Memory
55686 2018-07-08T15:12:42 Z minkank Ancient Books (IOI17_books) C++17
0 / 100
3 ms 528 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 >= 0 && a[n] == n) 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 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 3 ms 488 KB Output is correct
5 Incorrect 3 ms 528 KB 3rd lines differ - on the 1st token, expected: '4', found: '6'
6 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 3 ms 488 KB Output is correct
5 Incorrect 3 ms 528 KB 3rd lines differ - on the 1st token, expected: '4', found: '6'
6 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 3 ms 488 KB Output is correct
5 Incorrect 3 ms 528 KB 3rd lines differ - on the 1st token, expected: '4', found: '6'
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 528 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 3 ms 488 KB Output is correct
5 Incorrect 3 ms 528 KB 3rd lines differ - on the 1st token, expected: '4', found: '6'
6 Halted 0 ms 0 KB -