410803: GYM104118 E Escape from Markov
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
E. Escape from Markovtime limit per test2.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputExamplesInput
4 4 1 4 1 2 2 3 3 4 4 1 2 1 4 3 1 3Output
2Input
4 4 1 4 1 2 2 3 3 4 4 1 2 1 4 3 1 2Output
2Input
6 5 1 4 1 2 2 3 3 4 4 5 5 6 5 6 5 4 1 6Output
7Input
2 1 1 2 1 2 2 1 1 2Output
IMPOSSIBLE