Related
In following contests:
统计每个数的个数,然后用一个优先队列维护每个数,按照每个数出现的次数的一个小根堆。
一个贪心想法是,考虑每个数先和其他每个数配对一次,然后剩余多的数再自己和自己匹配。
因为每个数 n 个,每个数至多各进出一次优先队列。
至于为什么需要先和其他数匹配,再和自己匹配。
小美有 n 个数,现在他想给 n 个数两两配对,假设配对后为 (a,b),a≤b 。
In following contests:
By signing up a CodeFun2000 universal account, you can submit code and join discussions in all online judging services provided by us.