HDU5437 Alisha’s Party 优先队列】的更多相关文章

Alisha’s Party Time Limit: 3000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 2650    Accepted Submission(s): 722 Problem Description Princess Alisha invites her friends to come to her birthday party. Each o…
点击打开链接 可能出现的问题: 1.当门外人数不足p人时没有判断队列非空,导致RE. 2.在m次开门之后最后进来到一批人没有入队. 3.给定的开门时间可能是打乱的,需要进行排序. #include<cstdio> #include<cstring> #include<algorithm> #include<queue> #include<cstring> #include<iostream> #include<vector>…
Problem Description Princess Alisha invites her friends to come to her birthday party. Each of her friends will bring a gift of some value v, and all of them will come at a different time. Because the lobby is not large enough, Alisha can only let a…
Alisha’s Party Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1001&cid=621 Description Princess Alisha invites her friends to come to her birthday party. Each of her friends will bring a gift of…
Problem Description Princess Alisha invites her friends to come to her birthday party. Each of her friends will bring a gift of some value v, and all of them will come at a different time. Because the lobby is not large enough, Alisha can only let a…
Alisha 举办聚会,会在一定朋友到达时打开门,并允许相应数量的朋友进入,带的礼物价值大的先进,最后一个人到达之后放外面的所有人进来.用优先队列模拟即可.需要定义朋友结构体,存储每个人的到达顺序以及携带礼品价值,并重载<运算符.然后模拟即可. #include<iostream> #include<cstdio> #include<cstring> #include<vector> #include<algorithm> #include…
Alisha’s Party Problem's Link Mean: Alisha过生日,有k个朋友来参加聚会,由于空间有限,Alisha每次开门只能让p个人进来,而且带的礼物价值越高就越先进入. 给出开门的操作:当第ti个人来时,打开门让pi个人进入. q个询问,对于每个询问qi,你需要回答第qi个进入房间的人的名字. analyse: 维护一个优先队列,模拟就行. 需要注意,由于priority_queue对重载运算符貌似会出错,所以使用multiset来做priority_queue使用…
Alisha’s Party Time Limit: 3000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 7971    Accepted Submission(s): 1833 Description Princess Alisha invites her friends to come to her birthday party. Each of her f…
Problem Description Princess Alisha invites her friends to come to her birthday party. Each of her friends will bring a gift of some value v, and all of them will come at a different time. Because the lobby is not large enough, Alisha can only let a…
题意:邀请k个朋友,每个朋友带有礼物价值不一,m次开门,每次开门让一定人数p(如果门外人数少于p,全都进去)进来,当最后所有人都到了还会再开一次门,让还没进来的人进来,每次都是礼物价值高的人先进.最后给出q个数,表示要输出第ni个进来的人的名字. 析:其实这就是一个模拟题,很容易知道是优先队列模拟,不能set,会超时,反正我是超时了,然后就一步步的模拟就好了,注意它给的时间可能不是按顺序,要排序,在比赛时我就没排序,一直WA.... 代码如下: #include <cstdio> #inclu…