Submission #1028655

# Submission time Handle Problem Language Result Execution time Memory
1028655 2024-07-20T06:44:47 Z parsadox2 Ancient Books (IOI17_books) C++17
0 / 100
1 ms 348 KB
#include "books.h"
#include <bits/stdc++.h>

using namespace std;

const int N = 1e6 + 10;

int a[N] , n;
bool marked[N];

long long minimum_walk(vector<int> p, int s) {
	n = p.size();
	int ans = 0 , cnt = (p[0] == 0 ? 0 : 1);
	marked[p[0]] = true;
	for(int i = 1 ; i < n ; i++)
	{
		ans += max(2 * cnt , 2);
		cnt++;
		marked[p[i]] = true;
		if(marked[i])
			cnt--;
	}
	for(int i = n - 1 ; i >= 0 ; i--)
	{
		if(p[i] != i)
			break;
		ans -= 2;
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB 3rd lines differ - on the 1st token, expected: '8', found: '10'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB 3rd lines differ - on the 1st token, expected: '8', found: '10'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB 3rd lines differ - on the 1st token, expected: '8', found: '10'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 3rd lines differ - on the 1st token, expected: '3304', found: '239448'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB 3rd lines differ - on the 1st token, expected: '8', found: '10'
4 Halted 0 ms 0 KB -