
优先队列
xuanweiace
一个热爱算法竞赛的弱校ACMer路过。青大本,浙大硕,方向后端开发,菜鸡一枚,奋斗ing...
展开
-
【CodeForces - 305C】Ivan and Powers of Two(思维,STL,set,优先队列)
题干:Ivan has got an array of n non-negative integers a1, a2, ..., an. Ivan knows that the array is sorted in the non-decreasing order.Ivan wrote out integers 2a1, 2a2, ..., 2an on a piece of paper....原创 2018-11-29 22:40:48 · 259 阅读 · 0 评论 -
【51Nod - 1163】最高的奖励 (贪心+优先队列 或 妙用并查集)
题干:有N个任务,每个任务有一个最晚结束时间以及一个对应的奖励。在结束时间之前完成该任务,就可以获得对应的奖励。完成每一个任务所需的时间都是1个单位时间。有时候完成所有任务是不可能的,因为时间上可能会有冲突,这需要你来取舍。求能够获得的最高奖励。Input第1行:一个数N,表示任务的数量(2 <= N <= 50000)第2 - N + 1行,每行2个数,中间用空格分隔...原创 2018-10-17 19:41:19 · 380 阅读 · 0 评论 -
【CodeForces - 1042A】Benches (优先队列,思维模拟,maxmin问题)
题干:There are nn benches in the Berland Central park. It is known that aiai people are currently sitting on the ii-th bench. Another mm people are coming to the park and each of them is going to have...原创 2018-09-29 11:10:09 · 659 阅读 · 0 评论 -
【CodeForces - 1038C】Gambling (博弈问题,优先队列模拟,贪心)
题干:Two players A and B have a list of nn integers each. They both want to maximize the subtraction between their score and their opponent's score.In one turn, a player can either add to his score ...原创 2018-10-13 21:16:13 · 385 阅读 · 0 评论 -
*【CodeForces - 574A】Bear and Elections (优先队列,水题模拟)
题干:Limak is a grizzly bear who desires power and adoration. He wants to win in upcoming elections and rule over the Bearland.There are n candidates, including Limak. We know how many citizens are ...原创 2018-09-20 00:12:54 · 354 阅读 · 0 评论 -
【HDU - 4006】The kth great number (优先队列,求第k大的数)
题干:Xiao Ming and Xiao Bao are playing a simple Numbers game. In a round Xiao Ming can choose to write down a number, or ask Xiao Bao what the kth great number is. Because the number written by Xiao ...原创 2018-09-06 18:20:52 · 536 阅读 · 0 评论 -
【POJ - 3125 】Printer Queue(模拟,队列+优先队列,STL)
题干:The only printer in the computer science students' union is experiencing an extremely heavy workload. Sometimes there are a hundred jobs in the printer queue and you may have to wait for hours to...原创 2018-09-09 00:56:29 · 335 阅读 · 0 评论 -
【HRBUST - 1621】迷宫问题II (bfs)
题干:小z身处在一个迷宫中,小z每分钟可以走到上下左右四个方向的相邻格之一。迷宫中有一些墙和障碍物。同时迷宫中也有一些怪兽,当小z碰到任意一个怪兽时,小z需要将怪兽消灭掉才可以离开此方格。但消灭怪兽会花费一定的时间。现在小z想知道走出迷宫需要花费的最少时间。Input输入第一行为组数T(T<=10)。对于每组数据第一行为两个整数R和C(1<=R,C<=200)...原创 2019-05-09 21:57:23 · 364 阅读 · 0 评论 -
【ZOJ - 2724】【HDU - 1509】Windows Message Queue(优先队列)
题干:Message queue is the basic fundamental of windows system. For each process, the system maintains a message queue. If something happens to this process, such as mouse click, text change, the syste...原创 2018-08-02 16:40:53 · 234 阅读 · 0 评论 -
HDU 3785 寻找大富翁(sort排序或优先队列)
题干: 浙江桐乡乌镇共有n个人,请找出该镇上的前m个大富翁.Input输入包含多组测试用例. 每个用例首先包含2个整数n(0<n<=100000)和m(0<m<=10),其中: n为镇上的人数,m为需要找出的大富翁数, 接下来一行输入镇上n个人的财富值. n和m同时为0时表示输入结束.Output请输出乌镇前m个大富翁的财产数,财产多的排前面,如果大富翁不足...原创 2018-07-11 10:27:57 · 377 阅读 · 0 评论 -
*【HDU - 4006】 The kth great number(优先队列 or 线段树)
题干:Xiao Ming and Xiao Bao are playing a simple Numbers game. In a round Xiao Ming can choose to write down a number, or ask Xiao Bao what the kth great number is. Because the number written by Xiao ...原创 2018-07-30 00:10:12 · 218 阅读 · 0 评论 -
【HihoCoder - 1269】 优化延迟 (优先队列+二分优化)
题干:小Ho编写了一个处理数据包的程序。程序的输入是一个包含N个数据包的序列。每个数据包根据其重要程度不同,具有不同的"延迟惩罚值"。序列中的第i个数据包的"延迟惩罚值"是Pi。如果N个数据包按照<Pi1, Pi2, ... PiN>的顺序被处理,那么总延迟惩罚SP=1*Pi1+2*Pi2+3*Pi3+...+N*PiN(其中i1, i2, ... iN是1, 2, 3, .....原创 2018-07-26 00:39:21 · 253 阅读 · 0 评论 -
【HDU - 1873】 看病要排队(优先队列)
题干:看病要排队这个是地球人都知道的常识。 不过经过细心的0068的观察,他发现了医院里排队还是有讲究的。0068所去的医院有三个医生(汗,这么少)同时看病。而看病的人病情有轻重,所以不能根据简单的先来先服务的原则。所以医院对每种病情规定了10种不同的优先级。级别为10的优先权最高,级别为1的优先权最低。医生在看病时,则会在他的队伍里面选择一个优先权最高的人进行诊治。如果遇到两个优先权一样的病人的...原创 2018-07-15 23:38:57 · 280 阅读 · 0 评论 -
【牛客 - 369B】小A与任务(贪心,优先队列)
题干:链接:https://ac.nowcoder.com/acm/contest/369/B来源:牛客网小A手头有 n 份任务,他可以以任意顺序完成这些任务,只有完成当前的任务后,他才能做下一个任务第 i 个任务需要花费xixi的时间,同时完成第 i 个任务的时间不能晚于yiyi ,时间掌控者向小A提出了一个条件:如果完成第 i 个任务的时间本应是 t ,但小A支付 m...原创 2019-03-14 15:55:38 · 223 阅读 · 0 评论