![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
优先队列
chAngE_AC
这个作者很懒,什么都没留下…
展开
-
优先队列多级排序
#include #include #include #include #include #define LL long long using namespace std; struct node { int num,data; friend bool operator<(node a,node b) { if(a.data==b.data)原创 2015-08-27 19:30:05 · 457 阅读 · 0 评论 -
poj-1442 Black Box
题意:为了方便我通过解释输入数据来解释题意。输入两个数M表示序列长度,N表示输入N个数表示当前序列插入了几位,例如n=1序列里插入了3,n=6序列里插入了3 1 -4 2 8 -1000,对于第i个输入的n输入当前插入的序列中第i小的数,也就是前i小的数中最大的数。 思路:使用两个优先队列,递减队列中存前i小的数,递增队列中存剩下的数。每次输入n,就先向递增队列中压入n个数,然后原创 2015-08-21 15:15:48 · 660 阅读 · 0 评论 -
poj-3253-Fence Repair-优先队列(哈夫曼树)
Description Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of wood, each having some integer le原创 2015-08-12 16:03:42 · 608 阅读 · 0 评论