填空题

Wired wire

发布于 2022-03-03 17:21:38

P company has a huge data center with n servers. There are n - 1 lines between these servers. If two servers are connected by a wire, data can only be sent from one server to another, but not vise versa. Without considering the direction of data transmission, one server can reach any other servers, which means that all servers are connected. The engineer wants to select a central server which needs to send data to all other servers. To achieve this goal, the direction of some wires should be changed. The engineer is very lazy and he wants to select the server which can result in the least operations on wires. 输入描述: The first line contains an integer n, (2 <= n <= 100000) - the number of servers. Servers are numbered from 1 to n. Next n - 1 lines contain descriptions of the wire, one wire per line. A wire is described by two integers a, b(1 <= a, b <= n) - the number of the servers connected by the wire. The direction of data transmission is from a to b.输入样例: 4 3 1 4 2 3 4 输出描述: The first line prints the minimum number that the engineer should change. In the second line print all possible central servers. If there are multiple servers, print servers in the increasing order.输出样例 0 3
关注者
0
被浏览
26
知识点
面圈网VIP题库

面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦

去下载看看