P2927 [USACO08DEC] Jigsaw Puzzles S
Description
The cows have taken up alphabetical jigsaw puzzles. In these puzzles with R (1
Input Format
\* Line 1: Two space-separated integers: R and C
\* Lines 2..R\*C+1: Each line contains five space-separated entities: an integer serial number and four edge identifiers
Output Format
\* Lines 1..R\*C: Line R\*(i-1)+j describes the puzzle piece placed a row i, column j with an integer and five space-separated entities: the serial number of the puzzle piece and the four piece edge identifiers in the order top, right, bottom, left.
Explanation/Hint
Describes the input puzzle although with some of the pieces rotated compared to the sample solution.
As shown in the diagram in the task text. Other solutions (like reflections) are possible; a grading program will check your answer.