当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。
The first line contains an integer T (T ≤ 5), denoting the number of the test cases.For each test case, the first line contains an integer n(1 ≤ n ≤ 105).From the second to the n-th line, this n - 1 lines describe Bob' s Trie. The i-th line contains an integer u(u < i), and a lowercase letter c, which means that the father of node i is node u and the character on that edge is c. We ensure that for each node i, letters on edges connecting i and its children are all different.The next line contains an integer m(m ≤ 105), which means there are m operations.The next m lines describe all operations. In each line, the first integer indicates the type of this operation. 1 means Bob will add a new trait and 2 means Bob is asking you a question. The second integer k is the size of set P , and the next k integers are the elements of P. We ensure that these k integers are different, and they are all between 1 and n. The total size of the m sets will not be larger than 5*10^5.
For each test case, output the answer for each query operation, one answer in a line.
1 6 1 a 1 b 1 c 3 a 3 b 5 1 2 3 4 2 2 5 6 1 2 2 3 2 2 4 5 2 1 6
2 3 4
| bzoj_id | 3906 |
| import_source_sha256 | ebf7af88d47b489d7acfa680255878eb14453076c3ee503695d3f2ce62f65570 |
| bzoj_checker_pending | False |
| 时间上限 | 内存上限 |
| 6000 MS | 256 MB |