Sudoku Checker
Time limit2sMemory limit128 MB
Given an N^2 by N^2 grid with zeros for blanks, decide whether every row, column, and N by N square holds distinct nonzero numbers.
- Level
Easy3 of 10
- Topics
- Hash map, Implementation, Matrix
- Solved
- No attempts yet
Problem
Sudoku is a puzzle game played on a board of cells. The cells are grouped into squares of cells each. Each cell is either empty or contains a single number between and .
A sudoku position is correct when the filled numbers in each row, each column, and each square are all different. The goal of the game is to start from a correct position and fill every empty cell so that the final position is still correct.
Write a routine that determines whether a given position is correct.
Input
The input begins with the integer , followed by integers describing the sudoku position. Empty cells are denoted by .
Output
Print a single line containing either CORRECT or INCORRECT.
Constraints
- .