Baltic Olympiad in Informatics: 2003 Day 1, Problem 3
For the given integer
For example, a valid table for
The following tables are not valid for
because ; because the numbers in the last column and on one of the main diagonals start with the digit ; because the number is present twice in the table.
It is not always possible to solve this task. For example, the task is unsolvable for
Constraints
Each cell value must be an integer between
Input Specification
The input contains one integer
The input for these ten test cases are found as text files in the attachment below. Each test case file will contain one integer
For example, if 3.in
.
Output Specification
Output a valid table for test case
Grading
You will score
Otherwise your score for the test case is calculated from the formula:
Therefore, you should try to find a valid table with the least possible size, within the conditions given above.
Sample Input
0
Sample Output
3
2 3 4
5 6 6
8 2 0
Sample Explanation
The input contains 0.in
. 0.in
contains one integer
This table size is not minimized and thus wouldn't yield full points. Note that
Attachment Package
The input files are available here.
Comments