#P3416. [USACO16DEC] Moocast S
[USACO16DEC] Moocast S
题目背景
欢迎提供翻译,请直接在讨论区发帖,感谢你的贡献。
题目描述
Farmer John's cows () want to organize an emergency"moo-cast" system for broadcasting important messages among themselves.
Instead of mooing at each-other over long distances, the cows decide to equip themselves with walkie-talkies, one for each cow. These walkie-talkies each have a limited transmission radius -- a walkie-talkie of power can only transmit to other cows up to a distance of away (note that cow A might be able to transmit to cow B even if cow B cannot transmit back, due to cow A's power being larger than that of cow B). Fortunately, cows can relay messages to one-another along a path consisting of several hops, so it is not necessary for every cow to be able to transmit directly to every other cow.
Due to the asymmetrical nature of the walkie-talkie transmission, broadcasts from some cows may be more effective than from other cows in their ability toreach large numbers of recipients (taking relaying into account). Please help the cows determine the maximum number of cows that can be reached by a broadcast originating from a single cow.
约翰农场主的 头奶牛想建立一个紧急情况下的“哞哞广播”系统,这样它们就可以在自己中间广播重要信息。
奶牛们想让每头牛装备上一个对讲机,而不是在长距离中向另一头奶牛“哞哞”乱叫。这些对讲机每台都有各自的有效传输半径——一个拥有 能量的对讲机只能向距离在 以内的牛发送信息(注意可能出现 牛对讲机的能量比 牛的大,而 牛可以给 牛发送信息,但 牛不能传回信息)。幸运的是,奶牛们可以通过其他奶牛中继,沿着一条跳跃的路径传递信息,因此每个奶牛不必要直接向每个其他奶牛传播。
由于对讲机的费堆成性质,来自一些奶牛的广播可能比其他奶牛的广播能够达到更多的接受者(考虑中继的情况)的能力更有效。请帮助奶牛确定来自单个奶牛的广播可以达到的奶牛的最大数量。
输入格式
The first line of input contains .
The next lines each contain the and coordinates of a single cow ( integers in the range ) followed by , the power of the walkie-talkie held by this cow.
第一行,一个整数 。
接下来 行,第 行包括第 只牛的坐标 , 以及这只牛所持有对讲机的能量 。
输出格式
Write a single line of output containing the maximum number of cows a broadcast from a single cow can reach. The originating cow is included in this number.
一行,一个整数,表示从来自单个奶牛的广播可以达到的奶牛的最大数量。
开始的牛也包括在这个数量中。
4
1 3 5
5 4 3
7 2 1
6 1 1
3
提示
对于 的数据,,,。