poj3107 Godfather(鬼题畜译)

译文:
问题描述:

去年芝加哥发生了很多起谋杀案以及黑帮之间的火拼,警察局长真的是受够了这些罪犯,所以ta做了一个大胆的决定:擒贼先擒王——抓住黑手党老大(基里连科?)
这里写图片描述
不幸的是,芝加哥黑手党的内部结构相当复杂。现在警察锁定了n个人与黑手党有关。警察追踪他们的活动已经有一段时间了,并且知道他们中的一些人互相有往来。根据收集的数据,警察局长发现黑手党的等级制度可以用一棵树来表示。黑手党的首领,教父基里连科,是树的根,如果某个人用树中的一个节点来表示,ta的直接下属就由该节点的子节点来表示。为了不过度暴露,匪徒只与他们的直接下属和他们的直接上司沟通。
不幸的是,尽管警察知道匪徒的通讯往来,但他们不知道谁是通讯往来的上司。也就是说,他们只有一棵没有方向性的通讯树,并不知道教父是谁。
基于一般的认知,警察局长提出了一个假设,:黑手党教父希望拥有最大的权利。也就是说:逮捕ta之后,通信树中的最大剩余的连通块尽可能小。请帮助警察找到所有可能是的教父嫌疑犯,以便警察逮捕这些嫌疑犯。
这里写图片描述
输入
第一行包含一个n ,表示疑似黑手党的嫌疑犯的数量(2≤n≤50 000)。ta们的编号从1到n。
以下n-1行包含两个整数a,b,表示着歹徒a与歹徒b有沟通。保证是一棵树。

输出
输出所有被怀疑是教父的人的编号。数字必须以递增的顺序打印出来,用空格隔开。

样例输入
6个
1 2
2 3
2 5
3 4
3 6

样例输出
2 3
这里写图片描述

原文:
Description

Last years Chicago was full of gangster fights and strange murders. The chief of the police got really tired of all these crimes, and decided to arrest the mafia leaders.

Unfortunately, the structure of Chicago mafia is rather complicated. There are n persons known to be related to mafia. The police have traced their activity for some time, and know that some of them are communicating with each other. Based on the data collected, the chief of the police suggests that the mafia hierarchy can be represented as a tree. The head of the mafia, Godfather, is the root of the tree, and if some person is represented by a node in the tree, its direct subordinates are represented by the children of that node. For the purpose of conspiracy the gangsters only communicate with their direct subordinates and their direct master.

Unfortunately, though the police know gangsters’ communications, they do not know who is a master in any pair of communicating persons. Thus they only have an undirected tree of communications, and do not know who Godfather is.

Based on the idea that Godfather wants to have the most possible control over mafia, the chief of the police has made a suggestion that Godfather is such a person that after deleting it from the communications tree the size of the largest remaining connected component is as small as possible. Help the police to find all potential Godfathers and they will arrest them.

Input

The first line of the input file contains n — the number of persons suspected to belong to mafia (2 ≤ n ≤ 50 000). Let them be numbered from 1 to n.

The following n − 1 lines contain two integer numbers each. The pair ai, bi means that the gangster ai has communicated with the gangster bi. It is guaranteed that the gangsters’ communications form a tree.

Output

Print the numbers of all persons that are suspected to be Godfather. The numbers must be printed in the increasing order, separated by spaces.

Sample Input
6
1 2
2 3
2 5
3 4
3 6

Sample Output
2 3

转载于:https://www.cnblogs.com/wutongtong3117/p/7673145.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值