How to solve this problem in c ++?

Hello, does anyone know how to do this problem?

Try to write a program to check if a generalized sudoku board is completed correctly or not.

It is considered that a table is correctly completed if there are no duplicate values ​​on rows, columns or groups (squares).

Input data:
Unfortunately, the size of the board is not always the same, it being read from the keyboard at the beginning of the program, in the format:

line_number number_columns no_groups

Then enter from the keyboard the contents of each cell of the sudoku board, in the format:

line_number_column column_group number effective_value

Output data:
1 will be displayed if the board is correct, or 0 if not.

mentions:

The groups cannot overlap and are all the same size.
The value is just a natural number.
It is guaranteed that there are at least 2 rows, 2 columns, 2 groups.
The number of the row, column, group, starts from 0.

Example:
(comments are for clarity, they are not entered at the entrance)

4 4 4
0 0 0 1
0 1 0 2
1 0 0 3
1 1 0 4
// so far it was the first square
0 2 1 3
0 3 1 4
1 2 1 5
1 3 1 6
// so far the 2nd square
2 2 3 7
2 0 2 5
3 1 2 0
2 3 3 8
3 2 3 1
2 1 2 6
3 0 2 9
3 3 3 2
// last 2 mixed squares

the sudoku matrix would be: (4x4 with 4 groups)

1 2 | 3 4 3 4 | 5 6

5 6 | 7 8
9 0 | 1 2

this table is correct, having no duplicates either on the line, or on the column, or on the group.

Example of incorrect table:

1 1 | 3 4 3 4 | 5 6

5 6 | 7 8
9 0 | 1 2

line 0 has “1” doubled

1 2 | 3 4 1 4 | 5 6

5 6 | 7 8
9 0 | 1 2

column 0 has “1” doubled

1 2 | 3 4 3 4 | 5 6

5 6 | 7 8
9 0 | 1 7

group 3 has “7” doubled.
!! This is only 1 test, in total there are 5 to correct the problem.

Where??

are similar to this example, the numbers differ. Do you know how to solve?

@francexaw

1 Like

I need the coode, I tried, but I couldn’t.Can you help me?

The requirement is higher, sudoku verify.

You’ll have to give us the link to the problem before anyone will help you. This is so we’re sure you aren’t cheating on something.

1 Like

what link, I do not understand?

Where did you get the problem from?

is taken from a collection of computer science, can you help me?