#A5902. 奇怪的电梯

奇怪的电梯

Description

image.png

Input Format

image.png

Output Format

一行,即最少按键次数,若无法到达,则输出−1。

5 1 5
3 3 1 2 5
3

Source

信奥星OJ http://127.0.0.1