B - Begin the journey to a Higher Score
暂无测试数据。
Description
Some students have just took a test, and they are discussing it.
This test consists solely of multiple choice problems, and each student remembers his/her choice. They do not know which one is the answer.
There are problems in the test, the -th problem is of points. If the th problem is answered correctly, the value is added to to the score of the student. If it is answered incorrectly or not answered, the student’s score will not change. Your task is to give a set of correct answers and determine the maximum total score students may get.
Input
The first line of input contains a single integer
The second line contains space separated integers
Then lines follow, each line contains space separated integers, denoting the number of students who have chosen the corresponding choice. It is not guranteed that the sum of each line are pairwise equal(some students may have skipped problems). Refer to the example input for better understanding.
Output
Print two lines. The first line contains a single integer -- the maximal total students get.
The second line contains a string of length , it should contain only characters A,B,C
and D
. It should be a possible answer that yields the maximal total score . If multiple answers exist, print the lexicographically smallest(see Notes section) one.
Examples
Sample Input 1
Sample Output 1
Notice that does not equal to .
Sample Input 2
Sample Output 2
Notes
For two sequences and , both of length , we say is lexicographically smaller than , if and only if so that
- For all
- .
In this problem, the characters are compared using their ASCII number.
信息
- ID
- 1008
- 难度
- (无)
- 分类
- (无)
- 标签
- (无)
- 递交数
- 0
- 已通过
- 0
- 通过率
- ?
- 上传者