USACO 12月 2020-2021 December Contest Silver银组 题解

本题集包含三个关于农场动物的编程挑战:预测疾病传播速度、计算围栏可能圈住的牛群组合数量以及分析牛群间食物竞争导致的影响。通过解决这些问题,参赛者将运用算法和逻辑思维。

Problem 1. Cowntagion

Farmer John and his fellow farmers have been working nonstop to control the spread of the terrible bovine disease COWVID-19 across their farms.

Together, they oversee a collection of NN farms (1≤N≤1051≤N≤105), conveniently numbered 1…N1…N. The farms are connected by a set of N−1N−1 roads such that any farm can be reached from farm 1 by some sequence of roads.

Unfortunately, a cow in farm 1 has just tested positive for COWVID-19. None of the other cows at that farm or at any other farms have the disease yet. However, knowing the contagious nature of the disease, Farmer John anticipates exactly one of the following adverse events on each successive day:

(1) In a single farm, a "superspreader" event causes the number of cows at that farm with COWVID-19 to double; or

(2) A single cow with COWVID-19 moves along a road from one farm to an adjacent farm.

Farmer John is worried about how fast the outbreak might spread. Please help him by determining the minimum possible number of days before it could be the case that at least one cow in every farm has the disease.

INPUT FORMAT (input arrives from the terminal / stdin):

The first line contains the single integer NN. The next N−1N−1 lines each contain two space-separated integers aa and bb describing a road between farms aa and bb. Both aa and bb are

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值