ÀÂÒ
Language:

Remote Training on Programming

Problems On-line status Contests FAQ
For authors:
Register  ||  Login
 
Hello, Guest! Login or register.

411. Equal Sums

Time Limit: 1 seconds
Memory Limit:64000KB
Points:10
View Problem Statistics Submit Problem added Undefined

Divide sequence of numbers 1,2,...,N^(2) into N subsequences with equal sums.
If there are several solutions, out any of them.

Input data format:
One integer number N between 1 and 200.

Output data format:
N lines, each line contains N increasing numbers, separated by spaces.
Order of output of subsequences is inessential.

Example:

+---------------------------------------------------------------------------+
|                STDIN                 |             STDOUT                 | 
|--------------------------------------+------------------------------------|
|1                                     |1                                   |
|--------------------------------------+------------------------------------|
|2                                     |1 4                                 |
|                                      |                                    |
|                                      |2 3                                 |
|--------------------------------------+------------------------------------|
|3                                     |1 5 9                               |
|                                      |                                    |
|                                      |2 6 7                               |
|                                      |                                    |
|                                      |3 4 8                               |
+---------------------------------------------------------------------------+

View Problem Statistics Submit Author/source:
Problems from Contests / VoSTU Selection Rounds / Selection Round on ACM ICPC 2007 /
413. Clock 411. 414. Shortest Expression 412. Texture
We can all benefit by doing occasional "toy" programs, when artificial restrictions are set up, so that we are forced to push our abilities to the limit. The art of tackling miniproblems with all our energy will sharpen our talents for the real problems. Donald E. Knuth.
time generating 0.109 sec.
© Copyright VSTU, AVT, Nosov D.A.