ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

Open Ural FU Championship 2012

About     Problems     Submit solution     Judge status     Standings
Contest is over

C. Guns for Battle!

Time limit: 1.0 second
Memory limit: 64 MB
Will: Load the guns.
Annamaria: With what?
Will: Anything. Everything.
Gibbs: Anything we have left. Load the guns! Case shot and langrage. Nails and crushed glass.
“Black Pearl” always had some problems with discipline. It is known that you should start solving big problems from solving smaller ones, that is why, firstly, Joshami Gibbs decided to find out who is responsible for servicing the guns during the battle.
It was pretty hard. There are n guns on the ship. All guns are quite heavy and difficult to use, so two gunners are necessary to serve one gun. Since there are 2n + 1 gunners on board, one gunner has no pair in every battle. So, this pirate gets a role of commander during this battle.
Gibbs wants to make a schedule which will determine pairs of gunners and a commander for 2n + 1 coming battles. Gibbs does not want the same pair of pirates to be on duty more than one time according the schedule because the pirates working in pairs bother each other. Moreover, if during 2n + 1 battles one of the pirates is a commander twice or more, then Gibbs’s team will doubt in indifference of Gibbs, and it also leads to discipline problems. So many restrictions puzzled Joshami Gibbs. Help him make such schedule.


The only line contains one integer n that is the number of gunners on board (1 ≤ n ≤ 100).


Output 2n + 1 lines each containing 2n + 1 integers from 0 to 2n + 1, j-th number in i-th line is equal to number of battle where gunners i and j serve the gun together. Battles are numbered from 1. i-th number in i-th line is 0.


0 1 2
1 0 3
2 3 0
Problem Author: Alexander Ipatov (prepared by Oleg Dolgorukov)
Problem Source: Open Ural FU Championship 2012
To submit the solution for this problem go to the Problem set: 1933. Guns for Battle!