UVA12850 Skating Puzzle

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=861&page=show_problem&problem=4715 [PDF](https://uva.onlinejudge.org/external/128/p12850.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12850/3a25c6371b8122f885461a1ca3480d4ccb897100.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12850/7e6b72c54946d8e3eae6076b2d651a6227018e38.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12850/9c877f9f8efdbf238addaab5788f23f96f1f3469.png)