#P4573. Inequality Sudoku
Inequality Sudoku
Inequality Sudoku
This problem presents a special Sudoku puzzle where there are no given digits at the start. Instead, inequality relations (represented by the greater-than symbol, >
) between adjacent cells are provided. In addition to these inequalities (note that adjacent cells must not have identical numbers), the puzzle must satisfy the standard Sudoku rules:
- Each cell contains a digit from \(1\) to \(9\);
- Each row is a permutation of \(1,2,\ldots,9\);
- Each column is a permutation of \(1,2,\ldots,9\);
- Each \(3\times3\) submatrix (demarcated by thick lines in the figure, for a total of 9 such blocks) is a permutation of \(1,2,\ldots,9\).
For aesthetic reasons, every \(3\times3\) submatrix has all 12 pairs of adjacent cells with their inequality relations provided. The provided inequality clues, together with the standard Sudoku conditions, ensure that the puzzle has a unique solution.
Your task is to output the unique solution for this puzzle. The answer shown below is the unique solution:
5 3 4 6 7 8 9 1 2 6 7 2 1 9 5 3 4 8 1 9 8 3 4 2 5 6 7 8 5 9 7 6 1 4 2 3 4 2 6 8 5 3 7 9 1 7 1 3 9 2 4 8 5 6 9 6 1 5 3 7 2 8 4 2 8 7 4 1 9 6 3 5 3 4 5 2 8 6 1 7 9
Note: There is no input for this problem; the puzzle instance is fixed. Simply print the solution grid exactly as provided.
inputFormat
There is no input for this problem.
outputFormat
Output the solved Sudoku grid as 9 lines. Each line should contain 9 digits separated by a single space.
sample
N/A
5 3 4 6 7 8 9 1 2
6 7 2 1 9 5 3 4 8
1 9 8 3 4 2 5 6 7
8 5 9 7 6 1 4 2 3
4 2 6 8 5 3 7 9 1
7 1 3 9 2 4 8 5 6
9 6 1 5 3 7 2 8 4
2 8 7 4 1 9 6 3 5
3 4 5 2 8 6 1 7 9
</p>