Submission #355405

# Submission time Handle Problem Language Result Execution time Memory
355405 2021-01-22T12:53:56 Z juggernaut Ancient Books (IOI17_books) C++14
0 / 100
2000 ms 364 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 pivot=0;
	for(int i=0;i+1<n;i--){
		pivot=max(pivot,a[i]);
		if(i==pivot)ans+=2;
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2066 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2066 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2066 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2069 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2066 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -