|
||||||||||
SudokuTime Limit: 50000/20000 MS (Java/Others) Memory Limit: 125536/65536 K (Java/Others)Total Submission(s): 741 Accepted Submission(s): 307 Problem Description AmazingCaddy likes Sudoku very much. One day, he got some Sudoku problems and he wondered whether these problems are well designed. He needs your help now. Sudoku is a logic-based, combinatorial number-placement puzzle. The objective is to fill a 9 ¡Á 9 grid with digits so that each column, each row, and each of the nine 3 ¡Á 3 regions contain all of the digits from 1 to 9. -- Wikipedia In this problem, the grid has three different sizes, with the formal (N^2) ¡Á (N^2), and N will be one in 2, 3 and 4. The rule is the same. The objective is to fill the (N^2) ¡Á (N^2) grid with characters so that each column, each row, and each of the N^2 regions (each size is N ¡Á N) contains all of the characters from 1 to 4(N = 2), 1 to 9(N = 3) or 1 to G (N = 4). You task is that when you got a grid, you should tell the grid whether a puzzle or not. If it`s a puzzle, you should tell whether it is a minimal puzzle; else you should tell it has no solution or has multiple solutions. A puzzle is a partially completed grid (the size is (N^2) ¡Á (N^2), N = 2, 3, 4), and has one and only one solution. If remove any character from a puzzle, it will lead to multiple solutions, then it is called a minimal puzzle. Input The input contains several cases. For each case, the first line of the input is the N (2<= N <=4). The next N^2 lines will contain the grid. Each line will have N^2 characters, represent the grid. The empty cell will be represented as ¡¯.¡¯. All input data is legal, and you can get more information from the sample input. Output For each case: If the grid is not a puzzle, and has no solution, print ¡°No Solution¡±, or has multiple solutions print ¡°Multiple Solutions¡±. If the grid is a puzzle, but not a minimal, print ¡°Not Minimal¡±, or print N lines represent the answer in the same format in the input, and ¡®.¡¯ should be replaced with the right characters. You can get more information from the sample output. Sample Input
Sample Output
Source | ||||||||||
|