![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
优先队列
wwt9b15bs
这个作者很懒,什么都没留下…
展开
-
【题解】sdoj2796(同bzoj5088 hdu6000 雅礼集训2017Day4)(2018-08-11集训T3) 优先队列+贪心
题目链接题目描述你现在要洗 l 件衣服。你有 n 台洗衣机和 m 台烘干机。由于你的机器非常的小,因此你每次只能洗涤(烘干)一件衣服。 第 i台洗衣机洗一件衣服需要 wi 分钟,第 i 台烘干机烘干一件衣服需要 di 分钟。 请问把所有衣服洗干净并烘干,最少需要多少时间?假设衣服在机器间转移不需要时间,并且洗完的衣服可以过一会再烘干。输入输入文件的第一行三个整数 l 、n 和 ...原创 2018-08-11 16:04:53 · 208 阅读 · 0 评论 -
【题解】洛谷P1090合并果子[NOIP2004] 优先队列+贪心
每次选和最小的两堆合并就好。在被之前的一道堆优化贪心的比赛题蹂躏之后感觉有经验了,之前看过这题都没啥思路的。#include<cstdio>#include<queue>#define _rep(i,a,b) for(int i=(a);i<=(b);i++)using namespace std;int main(){ //freo原创 2018-08-13 07:01:17 · 244 阅读 · 0 评论 -
【题解】洛谷P1086花生采摘[NOIP2004普及] 模拟+优先队列
题目链接 做个普及的模拟还AC不了,参考了大佬博客调出错来……我怎么这么菜啊#include<cstdio>#include<queue>#include<cmath>using namespace std;#define _rep(i,a,b) for(int i=(a);i<=(b);i++)struct node{ int原创 2018-08-22 07:50:21 · 296 阅读 · 0 评论 -
【题解】poj3190 贪心+堆优化
题目链接 按照开始吃草的时间把牛排序。用一个小根堆维护每个畜栏最后一头牛结束吃草的时间,尝试把当前的牛安排在堆顶#include<cstdio>#include<algorithm>#include<queue>using namespace std;#define _rep(i,a,b) for(int i=(a);i<=(b);i++原创 2018-08-27 15:53:19 · 209 阅读 · 0 评论 -
【题解】poj3784 对顶堆算法+排序+优先队列
题目链接 对顶堆算法 序列中从小到大排名为1~M/2的整数存储到大根堆中,序列中从小到大排名M/2+1~M的整数存储在小根堆中,小根堆堆顶就是序列中位数#include<cstdio>#include<queue>#include<algorithm>#include<vector>using namespace st原创 2018-08-26 22:36:30 · 195 阅读 · 0 评论 -
【题解】codeforces1029E[Codeforces Round #506 (Div. 3)]E.Tree with Small Distances 优先队列+dfs
题目链接DescriptionYou are given an undirected tree consisting of nnn vertices. An undirected tree is a connected undirected graph with n−1n−1n−1 edges.Your task is to add the minimum number of edges i...原创 2018-09-24 20:57:40 · 345 阅读 · 0 评论 -
【题解】洛谷P2827[NOIP2016]蚯蚓 优先队列+模拟
题目链接最开始敲了个85的模拟……想想也没那么简单。学习了大佬题解,其中单调性很关键。#include<cstdio>#include<queue>#include<cmath>#include<algorithm>#define re register using namespace std;template<c...转载 2018-10-27 11:29:17 · 321 阅读 · 0 评论 -
【题解】[牛客网NOIP赛前集训营-提高组(第四场)]C.灭虫 线性DP+堆优化
题目链接#include<cstdio>#include<algorithm>#include<queue>using namespace std;const int N=3e3+10;struct node{ int p,l,r; bool operator <(const node&rhs)const{ retur...原创 2018-10-30 22:50:58 · 214 阅读 · 0 评论