Time limit
2s
Memory limit
128 MB
A DNA string is a string consisting only of A, C, T, and G. For two DNA strings X and Y of the same length, their DNA score is the sum of Score(X_i, Y_i) over every position i. Score is a 4 by 4 integer score table whose rows and columns are the four DNA characters.
The score table must satisfy all of the following rules.
-10 and 10, inclusive.Score(X, Y) = Score(Y, X).Score(X, X) > 0.0.You are given N DNA strings of equal length. Choose a score table that maximizes the average DNA score over all N(N-1)/2 unordered pairs of distinct strings, and output that maximum average.
The first line contains the number of DNA strings N, where N is a positive integer not greater than 50.
Each of the next N lines contains one DNA string. All strings have the same length, and the maximum length is 50.
Output the maximum possible average DNA score. Answers with absolute or relative error at most 10^-2 are accepted.
In the first public test, Score(A, A) and Score(A, C) can both be set to 10. The remaining entries can then be chosen to satisfy the rules, so each of the three string-pair scores is 30.