#P3670. [USACO17OPEN] Bovine Genomics S
[USACO17OPEN] Bovine Genomics S
题目描述
Farmer John owns cows with spots and cows without spots. Having just completed a course in bovine genetics, he is convinced that the spots on his cows are caused by mutations in the bovine genome.
At great expense, Farmer John sequences the genomes of his cows. Each genome is a string of length built from the four characters A, C, G, and T. When he lines up the genomes of his cows, he gets a table like the following, shown here
for :
Positions: 1 2 3 4 5 6 7 ... M
Spotty Cow 1: A A T C C C A ... T
Spotty Cow 2: G A T T G C A ... A
Spotty Cow 3: G G T C G C A ... A
Plain Cow 1: A C T C C C A ... G
Plain Cow 2: A G T T G C A ... T
Plain Cow 3: A G T T C C A ... T
Looking carefully at this table, he surmises that positions 2 and 4 are sufficient to explain spottiness. That is, by looking at the characters in just these two positions, Farmer John can predict which of his cows are spotty and which are not (for example, if he sees G and C, the cow must be spotty).
Farmer John is convinced that spottiness can be explained not by just one or two positions in the genome, but by looking at a set of three distinct positions. Please help him count the number of sets of three distinct positions that can each explain spottiness.
输入格式
The first line of input contains () and (). The next lines each contain a string of characters; these describe the genomes of the spotty cows. The final lines describe the genomes of the plain cows.
输出格式
Please count the number of sets of three distinct positions that can explain spottiness. A set of three positions explains spottiness if the spottiness trait can be predicted with perfect accuracy among Farmer John's population of cows by looking at just those three locations in the genome.
题目大意
题目描述
Farmer John 拥有 头有斑点的牛和 头没有斑点的牛。他刚刚完成了一门关于牛遗传学的课程,并确信他牛身上的斑点是由牛基因组中的突变引起的。
Farmer John 花费巨资对他的牛进行了基因组测序。每个基因组是一个由字符 A、C、G 和 T 组成的长度为 的字符串。当他将牛的基因组排列起来时,会得到如下表格,这里展示的是 的情况:
位置:1 2 3 4 5 6 7 ... M
斑点牛 1:A A T C C C A ... T
斑点牛 2:G A T T G C A ... A
斑点牛 3:G G T C G C A ... A
普通牛 1:A C T C C C A ... G
普通牛 2:A G T T G C A ... T
普通牛 3:A G T T C C A ... T
仔细观察这个表格后,他推测位置 2 和 4 足以解释斑点现象。也就是说,通过仅查看这两个位置的字符,Farmer John 可以预测哪些牛是有斑点的,哪些是没有斑点的(例如,如果他看到 G 和 C,这头牛一定是有斑点的)。
Farmer John 确信,斑点现象不仅仅可以通过基因组中的一个或两个位置来解释,而是可以通过查看三个不同的位置来解释。请帮助他计算能够解释斑点现象的三个不同位置集合的数量。
输入格式
输入的第一行包含 ()和 ()。接下来的 行每行包含一个长度为 的字符串,这些字符串描述了斑点牛的基因组。最后的 行描述了普通牛的基因组。
输出格式
请计算能够解释斑点现象的三个不同位置集合的数量。如果通过查看基因组中这三个位置的字符,可以在 Farmer John 的牛群中完美准确地预测斑点性状,那么这个三个位置的集合就解释了斑点现象。
3 8
AATCCCAT
GATTGCAA
GGTCGCAA
ACTCCCAG
ACTCGCAT
ACTTCCAT
22