Problem
A quartet is consistent with a binary tree if the quartet can be inferred from one of the splits of (see “Quartets” for a description of inferring quartets from splits).
Let denote the total number of quartets that are consistent with .
Given: A positive integer (), followed by an unrooted binary tree in Newick format on taxa.
Return: The value of modulo 1,000,000.
四重奏 是一致用二叉树 如果四重奏可以从一个推断分裂的(有关从分割中推断四重奏的说明,请参见“四重奏”)。
让 表示符合的四重奏总数 。
给定:正整数 (),然后是无根的二叉树 在Newick格式上 分类单元。
返回值: 模1,000,00
Sample Dataset
6 (lobster,(cat,dog),(caterpillar,(elephant,mouse)));
Sample Output
15