Mathematical and Physical Journal
for High Schools
Issued by the MATFUND Foundation
Already signed up?
New to KöMaL?

Problem I. 286. (February 2012)

I. 286. The following game is played on a 4×8 board. The aim is to fill it completely by 8 pieces of different shape. Each piece should be used only once. The example shows a possible solution (also specifying the shapes).

Of course, these pieces can be arranged differently, but they should fill the board completely. Pieces can be rotated by 90 degrees, or flipped, so each piece can have 8 positions.

The color of each piece is also specified, and it is may be prescribed that some squares should be covered by a specified color.

Your program should give a possible arrangement of the pieces. The first command line argument of your program is the name of the file describing the color of the pieces and the color of certain squares. The second command line argument is the name of the file containing your solution. Only solvable cases will be used during testing.

The first line of the input file contains colors of the 8 pieces (in a similar order as in the figure), separated by a space. The color is denoted by a single character. The next 4 lines describe the obligatory colors of the board, with 8 characters in each line, separated by a space: either a color code or a *, if the color of that square can be arbitrary after covering.

The output file describes the filled rectangle. It should contain exactly 4 lines, with 8 digits in each line, separated by a space. The digits give the number of the actual piece.

In the example, be.txt is the sample input, while ki.txt is the corresponding output.

The source code (i286.pas, i286.cpp, ...) together with a short documentation (i286.txt, i286.pdf, ...) -- also describing which developer environment to use for compiling, further a brief description of your solution -- should be submitted in a compressed file i286.zip.

(10 pont)

Deadline expired on March 12, 2012.


Sorry, the solution is available only in Hungarian. Google translation

Egy kivétellel minden beküldő programja helyes kimenetet rendelt minden bemeneti állományhoz. Leírásukban megadott módszer is egyezett, visszalépéses algoritmussal dolgoztak.

A tesztesetek között a mintaként megadott, a már kitöltött és az üres táblák mellett szerepelnek az eredeti játékleírásban szereplő feladványok is. (Ott az a nehezítés, hogy az elemek megadott pontja kell essen a színnel jelölt helyre.)

A tesztfájlok: i286teszt.zip


Statistics:

7 students sent a solution.
10 points:Antal János Benjamin, Jákli Aida Karolina, Kovács Balázs Marcell, Kucsma Levente István, Szabó Levente, Varga 256 Erik.
0 point:1 student.

Problems in Information Technology of KöMaL, February 2012