An
- Each character is either
A
,B
, orC
. - Every
by subgrid contains all three different letters. - Any two cells that share exactly one corner contain different letters.
Let
You want to construct a good grid that satisfies some of
Find a good grid that gets the most total number of points.
Constraints
For all
Input Specification
The first line contains three space-separated integers:
The next
Output Specification
On the first line, output the maximum total number of points obtainable by a good grid.
On the next
Scoring
For each test case:
- You will receive
of the points if your first line of output contains the correct answer and the remaining lines contain a correctly formatted good grid that obtains this total number of points. - Otherwise, you will receive
of the points if your first line of output contains the correct answer. You do not need to print anything after the first line if you are aiming for these partial points, as long as you ensure that the first line is terminated by a\n
character. You will still receive these partial points if you output a malformatted or incorrect grid. - Otherwise, you will receive
points.
Your final score is the minimum score over all test cases.
Sample Input
3 4 6
3 1 2 1 3
1 2 3 1 3
4 3 4 2 4
1 2 2 3 2
5 2 1 2 2
9 2 1 2 2
Sample Output
21
BAAA
CCBC
BAAC
Explanation
This grid is good and satisfies the
Comments