Sudoku Verify
시간 제한1초메모리 제한2048 MB
완성된 9x9 스도쿠 판에서 각 행, 열, 3x3 영역에 1부터 9까지의 숫자가 정확히 한 번씩 나오는지 확인한다.
문제
A Sudoku puzzle is a number puzzle that is played on a grid of cells. These cells are grouped into nine () non-overlapping regions, for a total of nine () cells per region. The regions are shown outlined in bold on the figure on the right.
The initial state of the grid has some of the cells filled in (black in the figure on the right). The objective is to use logical inferences to fill in the rest of the board. But there are rules for how to fill out the remainder of the board. The rules are as follows:
- Along every column, every number between and (inclusive) must appear exactly once.
- Along every row, every number between and (inclusive) must appear exactly once.
- In each region, every number between and (inclusive) must appear exactly once.
You are given a completed Sudoku puzzle. Determine whether it is valid.
입력
Each row of the filled out Sudoku puzzle corresponds to one line of input. The numbers of each row are separated by a single space. This encoding leads to an input with exactly nine () lines each of which contains exactly nine () numbers between and inclusive.
출력
If the Sudoku board is valid, output the text "VALID" (without the quotes).
If the Sudoku board is not valid, output the text "INVALID!" (without the quotes).