|
||||||||||
Eleven puzzleTime Limit: 20000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 935 Accepted Submission(s): 270 Problem Description Partychen invents a new game named ¡°Eleven Puzzle¡± .Just like the classic game ¡°Eight Puzzle¡±,but there some difference between them:The shape of the board is different and there are two empty tiles. The tile in black means it¡¯s empty Each step you can move only one tile. Here comes the problem.How many steps at least it required to done the game. Input The first line of input contains one integer specifying the number of test cases to follow. Every case contains five lines to describe the initial status of the board. 0 means empty. It¡¯s confirmed that the board is legal. Output Output one line for each testcase.Contain an integer denotes the minimum step(s) it need to complete the game.Or ¡°No solution!¡± if it¡¯s impossible to complete the game within 20 steps. Sample Input
Sample Output
Source | ||||||||||
|