Submission #139018

# Submission time Handle Problem Language Result Execution time Memory
139018 2019-07-31T07:47:16 Z Bohoty Ancient Books (IOI17_books) C++14
0 / 100
2000 ms 256 KB
#include<bits/stdc++.h>
#include "books.h"
using namespace std;
int solve(int idx, int picked, vector < int > &v){
	if (picked == -1 && v[idx] != idx){
		picked = v[idx];
		v[idx] = -1;
	}
	if (picked == idx){
		swap(v[idx], picked);
	}
	if (picked > idx || picked == -1)
		return solve(idx + 1, picked, v) + 1;
	else
		return solve(idx - 1, picked, v) + 1;
}
long long minimum_walk(std::vector<int> v, int s) {
	return solve(s, -1, v);
	return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2075 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2075 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2075 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2037 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2075 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -