## Miniature Sudoku

View as PDF

Points: 7
Time limit: 0.6s
Java 1.0s
Python 1.4s
Memory limit: 64M
Python 256M

Author:
Problem type

The puzzle game Sudoku is a classical game. In the puzzle, the player is given a partially filled grid. The objective of the game is to fill in the grid such that each row, column, and each of the nine subgrids contain all the digits from to .

An example of a solved Sudoku grid.

Jonathan is playing Sudoku! However, his version of Sudoku is slightly different. He is instead given a partially filled grid, and the objective is to fill in the grid such that each row, column, and each of the four subgrids contain all the digits from to .

He is given of these puzzles. However, since he is too lazy to solve them manually, he has asked you to help him solve them with a computer program!

#### Input Specification

The first line will contain the integer , the number of grids that Jonathan needs solved.

Each of the grids will contain lines consisting of characters, for a total of lines. It is guaranteed the grid will only contain the characters 1, 2, 3, 4, and X. X means that the cell is unfilled, and you must fill it in with the appropriate value.

#### Output Specification

For each grid, output lines, the filled in grid. The output should therefore consist of a total of lines.

Any valid solution will be accepted. It is guaranteed each grid will have at least one solution.

#### Note for Sample

The sample does not respect the constraints. Your solution does not need to produce the correct output on the sample to get AC. In particular, the sample has while the actual test data will have .

#### Sample Input

3
1234
4321
2413
3142
1234
4XX1
2XX3
3142
231X
142X
413X
XXXX

#### Sample Output

1234
4321
2413
3142
1234
4321
2413
3142
2314
1423
4132
3241

#### Explanation for Sample

The third case in the sample is:

The only possible filled-in grid would be:

## Comments

• commented on April 20, 2019, 2:17 a.m.

NO NO NO STOP THIS PROBLEM IS ILLEGAL

• commented on April 21, 2019, 3:53 a.m.
• commented on April 22, 2019, 12:16 p.m.

Sexism! You add Girls to the name and it automatically makes the question worth 5 more points. (joke)

• commented on April 25, 2019, 2:18 a.m.

For what it's worth, I was not the one to set the final point value for this problem.

• commented on April 21, 2019, 4:10 p.m.

when evan uploads girls invitational problem onto the dmoj