HBC25064中位数[USACO 2007 Mar G]Ranking the Cows题解

一沫阳光 算法基础篇 72 0
不断提升技能,才能在职场中立于不败之地!全网最全C++题库,助您成为编程领域的佼佼者。
Each of Farmer John's N cows produces milk at a different positive rate, and FJ would like to order his cows according to these rates from the fastest milk producer to the slowest.FJ has already compared the milk output rate for M pairs of cows. He wants to make a list of C additional pairs of cows such that, if he now compares those C pairs, he will definitely be able to deduce the correct ordering of all N cows. Please help him determine the minimum value of C for which such a list is possible.

Each of Farmer John's N cows (1 ≤ N ≤ 1,000) produces milk at a different positive rate, and FJ would like to order his cows according to these rates from the fastest milk producer to the slowest. FJ has already compared the milk output rate for M (1 ≤ M ≤ 10,000) pairs of cows. He wants to make a list of C additional pairs of cows such that, if he now compares those C pairs, he will definitely be able to deduce the correct ordering of all N cows. Please help him determine the minimum value of C for which such a list is possible.

HBC25064中位数[USACO 2007 Mar G]Ranking the Cows题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)

标签: HBC25064中位数[USACO 2007 Mar G]Ranking the Cows题解