#C12092. Sudoku Validator
Sudoku Validator
Sudoku Validator
You are given a 9x9 Sudoku puzzle. Your task is to determine whether the puzzle is valid, solved, or invalid.
A Sudoku puzzle is composed of 9 rows and 9 columns with cells containing digits from 1 to 9 or 0 representing an empty cell. The puzzle must satisfy the following conditions:
- Each row must contain unique non-zero values.
- Each column must contain unique non-zero values.
- Each of the nine $3\times3$ subgrids must contain unique non-zero values.
If all conditions are satisfied and there is at least one 0 present, output Valid Sudoku
. If all conditions are satisfied and there are no 0's, output Sudoku Solved
. Otherwise, output Invalid Sudoku
.
inputFormat
The input consists of 9 lines. Each line contains 9 integers separated by a space representing a row of the puzzle. The integer 0 represents an empty cell.
Input is provided via standard input (stdin).
outputFormat
Output a single line that is either Valid Sudoku
, Sudoku Solved
, or Invalid Sudoku
according to the puzzle's correctness.
Output should be written to standard output (stdout).
## sample5 3 0 0 7 0 0 0 0
6 0 0 1 9 5 0 0 0
0 9 8 0 0 0 0 6 0
8 0 0 0 6 0 0 0 3
4 0 0 8 0 3 0 0 1
7 0 0 0 2 0 0 0 6
0 6 0 0 0 0 2 8 0
0 0 0 4 1 9 0 0 5
0 0 0 0 8 0 0 7 9
Valid Sudoku