#ARC127B. [ARC127B] Ternary Strings
[ARC127B] Ternary Strings
Score : points
Problem Statement
Given are integers and . Find a tuple of strings that satisfies all of the following conditions.
- is a string of length consisting of
0,1,2. - All are pairwise distinct.
- For every () and every
0,1,2, the following holds.- For exactly of the strings , the -th character is .
- For exactly of the strings , the -th character is .
- Let be the lexicographically largest string among . for this tuple is the lexicographically smallest among all strings that can be.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer in the following format:
If there are multiple solutions satisfying the conditions, any of them will be accepted.
2 2
00
02
11
12
20
21
This Sample Output satisfies all conditions.
For example, there are two strings whose second character is 0.
Also, we have 21 in this sample, and is never lexicographically smaller than this.