Canadian Computing Competition: 2023 Stage 1, Senior #3
Ryo and Kita are designing a new poster for Kessoku Band. After some furious brainstorming,
they came to the conclusion that the poster should come in the form of a 2-D grid of
lowercase English letters (i.e. a
to z
), with
Furthermore, it is known that Ryo and Kita both have peculiar tastes in palindromes. Ryo
will only be satisfied with the poster if exactly
Note: A string is considered a palindrome if it is the same when read forwards and backwards. For example, kayak
and bb
are palindromes, whereas guitar
and live
are not.
Input Specification
The first and only line of input consists of
The following table shows how the available 15 marks are distributed:
Marks Awarded | Bounds on |
Bounds on |
Bounds on |
Bounds on |
---|---|---|---|---|
2 marks | ||||
2 marks | ||||
4 marks | ||||
7 marks |
Output Specification
If it is impossible to design a poster that will satisfy both Ryo and Kita, output IMPOSSIBLE
on a single line.
Otherwise, your output should contain
Sample Input 1
4 5 1 2
Output for Sample Input 1
union
radar
badge
anime
Explanation of Output for Sample Input 1
In the given design, only the second row (namely radar
) and the second and third columns
(namely naan
and iddi
) are palindromes. Since exactly
Sample Input 2
2 2 2 1
Output for Sample Input 2
IMPOSSIBLE
Explanation of Output for Sample Input 2
In this case, it can be proven that it is impossible to satisfy both Ryo and Kita.
Comments
no way comments are locked on ccc
no way bocchi the lock on comment rock
no way bocchi the rock on ccc
no way bocchi the rock on ccc
no way bocchi the rock on ccc
This comment is hidden due to too much negative feedback. Show it anyway.
no way bocchi the rock on ccc
no way bocchi the rock on ccc
no way bocchi the rock on ccc
no way bocchi the rock on ccc
no way bocchi the rock on ccc
no way bocchi the rock on ccc