ΠΔΠ-21 (2009) - Phase A (Alexander)

View as PDF

Submit solution

Points: 10 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
C, C++, Java, Pascal, Python
The Mosaic of Alexander the Great

The Macedonians, a Doric Greek tribe with tall individuals, sharing the same language, religion, customs, and traditions, as well as the same historical trajectory as the other Greek tribes, unified under Philip II (382 – 336 BC) the Greek Kingdoms (Pan-Hellenic Alliance). Immediately after, under his son, Alexander the Great (356 - 323 BC), they established the largest empire of all time. The Romans, whose empire succeeded that of Alexander the Great, never hid their admiration for the great strategist. In Pompeii, a significant part of one of the oldest mosaics of Alexander the Great has been preserved, depicting Alexander defeating Darius at the Battle of Issus.

The Aristotle University of Thessaloniki has been systematically conducting archaeological research for many decades on the period of the peak of the Macedonian civilization in the broader Greek and international context. Astonished, the researchers of AUTh found that the colored tesserae used to construct the mosaic had the same chemical composition and two different concentrations of Magnesium (Mg), which were only identified in the wider regions of Pella (P) and Vergina (V), respectively! Fragments from other mosaics of the Hellenistic period, from all over the then-known world, confirmed the same results. It is evident that Greek kings and later Romans considered it a symbol of power to decorate their kingdoms with colored tesserae from metropolitan Greece, especially from the region of Macedonia. From a technical perspective, it is interesting that no tessera was in direct contact vertically or horizontally with a tessera of similar origin. The following diagram shows an enlarged section of the mosaic.

pdp-2009-A.svg

Problem:

Develop a problem in one of the languages of the IOI that, after reading the dimensions of the mosaic and the type of the first tessera, will return the arrangement of the tesserae from the two locations.

Input Files:

The input files named Alexander.in are text files with the following structure: The first line contains two numbers. The number of lines, 10 \le L \le 10.000, and the number of tesserae per line, 10 \le C \le 12.000, separated by a space. The second line contains the character P or V, corresponding to the origin of the first tessera.

Output Files:

The output files named Alexander.out are text files with the following structure: They consist of L lines, each containing C characters (P or V) without spaces between them.

Examples of Input - Output Files:
1ο

STDIN (Alexander.in)

10 10
P

STDOUT (Alexander.out)

PVPVPVPVPV
VPVPVPVPVP
PVPVPVPVPV
VPVPVPVPVP
PVPVPVPVPV
VPVPVP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