我是靠谱客的博主 平淡鱼,最近开发中收集的这篇文章主要介绍Auxiliary Set(dfs求每个节点的儿子个数) Auxiliary Set,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

Auxiliary Set

Time Limit: 9000/4500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 491    Accepted Submission(s): 136


Problem Description
Given a rooted tree with n vertices, some of the vertices are important.

An auxiliary set is a set containing vertices satisfying at least one of the two conditions:

It is an important vertex
It is the least common ancestor of two different important vertices.

You are given a tree with n vertices (1 is the root) and q queries.

Each query is a set of nodes which indicates the  unimportant vertices in the tree. Answer the size (i.e. number of vertices) of the auxiliary set for each query.
 

Input
The first line contains only one integer T ( T1000 ), which indicates the number of test cases.

For each test case, the first line contains two integers n ( 1n100000 ), q (

最后

以上就是平淡鱼为你收集整理的Auxiliary Set(dfs求每个节点的儿子个数) Auxiliary Set的全部内容,希望文章能够帮你解决Auxiliary Set(dfs求每个节点的儿子个数) Auxiliary Set所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(47)

评论列表共有 0 条评论

立即
投稿
返回
顶部