2.15号英语翻译
题目来源:https://acs.jxnu.edu.cn/problem/NOIOPJCH03062392
重点词汇:
branch:n.分支;
spigot,:n.塞子;
specifies:v.提起;
barn:n.谷,粮仓;
sweltering:adj.闷热的;
district :n.区域,县;
stimulate:v.刺激,促进;
slake their thirst:解渴;
Clear Cold Water
10000ms 1000K
描述:
The steamy, sweltering summers of Wisconsin's dairy district stimulate the cows to slake their thirst. Farmer John pipes clear cold water into a set of N (3 <= N <= 99999; N odd) branching pipes conveniently numbered 1..N from a pump located at the barn. As the water flows through the pipes, the summer heat warms it. Bessie wants to find the coldest water so she can enjoy the weather more than any other cow.She has mapped the entire set of branching pipes and noted that they form a tree with its root at the farm and furthermore that every branch point has exactly two pipes exiting from it. Surprisingly, every pipe is exactly one unit in length; of course, all N pipes connect up in one way or another to the pipe-tree.
Given the map of all the pipe connctions, make a list of the distance from the barn for every branching point and endpoint.Bessie will use the list to find the very coldest water.
The endpoint of a pipe, which might enter a branching point or might be a spigot, is named by the pipe's number. The map contains C (1 <= C <= N) connections, each of which specifies three integers: the endpoint E_i (1 <= E_i <= N) of a pipe and two branching pipes B1_i and B2_i (2 <= B1_i <= N; 2 <= B2_i <= N). Pipe number 1 connects to the barn; the distance from its endpoint to the barn is 1.
威斯康星州乳制品区炎热、闷热的夏天刺激奶牛解渴。 Farmer John 将干净的冷水从位于谷仓的泵中输送到一组 N(3 <= N <= 99999;N 奇数)支管中,方便编号为 1..N。当水流过管道时,夏天的热量会使它变暖。贝西想找到最冷的水,这样她就可以比其他任何奶牛更享受天气了。
她绘制了整套分支管道的地图,并指出它们形成了一棵树,其根在农场,而且每个分支点正好有两条管道从它引出。令人惊讶的是,每根管道的长度正好是一个单位。当然,所有 N 个管道都以一种或另一种方式连接到管道树。
给定所有管道连接的地图,列出每个分支点和端点到谷仓的距离。Bessie 将使用该列表找到最冷的水。
可能进入分支点或可能是套管的管道端点由管道编号命名。该映射包含 C (1 <= C <= N) 个连接,每个连接指定三个整数:一个管道的端点 E_i (1 <= E_i <= N) 和两个分支管道 B1_i 和 B2_i (2 <= B1_i < = N; 2 <= B2_i <= N)。 1 号管道连接到谷仓;从它的端点到谷仓的距离是 1。
输入:
* Line 1: Two space-separated integers: N and C* Lines 2..C+1: Line i+1 describes branching point i with three space-separated integers: E_i, B1_i, and B2_i
输入:* 第 1 行:两个空格分隔的整数:N 和 C
* 第 2..C+1 行:第 i+1 行用三个空格分隔的整数描述分支点 i:E_i、B1_i 和 B2_i
输出:
* Lines 1..N: Line i of the output contains a single integer that is the distance from the barn to the endpoint of pipe i输出:* 第 1..N 行:输出的第 i 行包含一个整数,表示从谷仓到管道 i 端点的距离
样例输入:
5 2 3 5 4 1 2 3
样例输出:
1 2 2 3 3
注释:
INPUT DETAILS:The input above describes this pipe map:
+------+
| Barn |
+------+
| 1
*
2 / \ 3
*
4 / \ 5
OUTPUT DETAILS:
Pipe 1 is always distance 1 from the barn. Pipes 2 and 3 connect directly to pipe 1 and thus are distance 2 from the barn. Pipes 4 and 5, which connect to pipe 3, are distance 3 from the barn.
Source: USACO Open 2008 Bronze