loj 2778 "BalticOI 2018" Genetic Engineering

serious

luogu

This internal vector product of a routine problem that road and NOI

First consider the number of required elements of two different rows, can be converted into a row vector \ (A \) and column vector \ (B \) obtained by multiplying a value. If only \ (A, C \) two character, then so that the corresponding weight value \ (. 1 = a, C = -1 \) , then the number of different elements of the two rows can be expressed as \ (\ m-ab & FRAC {{2}} \) , extended to four characters case, then engage in three forms, namely \ (A = C = 1, G = T = -1 | A = 1, C = -1, G = T = 0 | A = C = 0, G = 1 , T = -1 \) , for the corresponding row vector notation \ (A1, A2, A3 \) , is a column vector \ (B1, B2, B3 \) , then the number of different elements should be their \ (\ FRAC {3m- (a1b1 + 2a2b2 + 2a3b3 )} {4} \)

If every violent compared to the complexity is the same as with the ordinary violence, so consider row vector of all rows add up, then take on to compare the column vector of the line, if this line is the answer to the requirements, then you will get the value should be \ ((the n--1) k \) . However, if the results obtained are \ ((the n--1) k \) , this line is likely not the answer. in order to avoid this situation, we might give each line a random a weight \ (w_i \) , so that any value line and draw the line matching is multiplied by \ (w_i \) , then the answer row \ (ans \) column vector by a row vector sum of the results should be is \ (\ sum_ {I \} W_i NEQ ANS K \) . such enumeration each row, and then by row vector of the check with the corresponding column vector on the line

Details look at the code itIt is too lazy to write

code

Guess you like

Origin www.cnblogs.com/smyjr/p/11317936.html