Programming contests

ACM ICPC programozó csapatverseny, házi forduló, 2015. október 21.

October 21, 2015, 10:00 AM – October 21, 2015, 3:00 PM

The House of Santa Claus

In your childhood, you most likely had to solve the riddle of the house of Santa Claus. Do you remember that the importance was on drawing the house in a stretch without lifting the pencil and not drawing a line twice? As a reminder, it has to look like shown in Figure 1.


Figure 1: The house of Santa Claus

Well, a couple of years later, like now, you have to “draw” the house again, but on the computer. As one possibility is not enough, we require all the possibilities when starting in the lower left corner. Follow the example in Figure 2 while defining your sketch.


Figure 2: This sequence would give the output line 153125432

All the possibilities have to be listed in the output in increasing order, meaning that 1234… is listed before 1235

Input Specification

There is no input for this problem.

Output Specification

The output could look like this:

12435123
13245123

15123421

University of Debrecen; Faculty of Informatics; v. 09/30/2024