HDU 5360 Hiking(优先队列)
Hiking
Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 492 Accepted Submission(s): 263
Special Judge
conveniently labeled by 1,2,…,n.
beta, their best friends, wants to invite some soda to go hiking. The i-th
soda will go hiking if the total number of soda that go hiking except him is no less than li and
no larger than ri.
beta will follow the rules below to invite soda one by one:
1. he selects a soda not invited before;
2. he tells soda the number of soda who agree to go hiking by now;
3. soda will agree or disagree according to the number he hears.
Note: beta will always tell the truth and soda will agree if and only if the number he hears is no less than li and
no larger than ri,
otherwise he will disagree. Once soda agrees to go hiking he will not regret even if the final total number fails to meet some soda's will.
Help beta design an invitation order that the number of soda who agree to go hiking is maximum.
indicating the number of test cases. For each test case:
The first contains an integer n (1≤n≤105),
the number of soda. The second line constains n integers
posted on 2017-05-06 17:53 cynchanpin 阅读(...) 评论(...) 编辑 收藏
var allowComments=true,cb_blogId=347763,cb_entryId=6817500,cb_blogApp=currentBlogApp,cb_blogUserGuid='43c87c18-831e-e711-9fc1-ac853d9f53cc',cb_entryCreatedDate='2017/5/6 17:53:00';loadViewCount(cb_entryId);var cb_postType=1;var isMarkdown=false;
HDU 5360 Hiking(优先队列)的更多相关文章
- hdu 5360 Hiking(优先队列+贪心)
题目:http://acm.hdu.edu.cn/showproblem.php? pid=5360 题意:beta有n个朋友,beta要邀请他的朋友go hiking,已知每一个朋友的理想人数[L, ...
- HDU 5360 Hiking(优先队列)2015 Multi-University Training Contest 6
Hiking Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total S ...
- 2015多校第6场 HDU 5360 Hiking 贪心,优先队列
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5360 题意:给定n个人,现在要邀请这些人去远足,但每个人同意邀请的条件是当前已经同意去远足的人数c必须 ...
- HDU 5360——Hiking——————【贪心+优先队列】
Hiking Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Su ...
- HDU 5360 Hiking 登山 (优先队列,排序)
题意: 有n个人可供邀请去hiking,但是他们很有个性,每个人都有个预期的人数上下限[Li,Ri],只有当前确定会去的人数在这个区间内他才肯去.一旦他答应了,无论人数怎样变更,他都不会反悔.问最多能 ...
- HDOJ 5360 Hiking 优先队列+贪心
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=5360 题意: 大概的意思就是每个人有个人数接受范围$[l_i,r_i]$,现在你每次能从还未被选取的人 ...
- 2015 Multi-University Training Contest 6 hdu 5360 Hiking
Hiking Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Su ...
- HDU 5360 Hiking (贪心)
题意:邀请 n 参加聚会,如果在邀请第 i 个人之前,已经成功邀请了 x 个人,并且 li <= x <= ri,那么第 i 人才会去,问你怎么排列使得邀请的人最多. 析:对于所有的人,按 ...
- HDU 5360 【优先队列+贪心】
题意: 给定N个无序区间. 对合法区间的定义是: 在这个区间之前已经选出了至少l个合法区间,最多选出了r个合法区间.则该区间为合法区间. 输出最多能挑选出多少个合法区间,并输出合法区间的数量. 思路: ...
随机推荐
- hnust 可口可乐大促销
问题 B: 可口可乐大促销 时间限制: 1 Sec 内存限制: 128 MB提交: 653 解决: 323[提交][状态][讨论版] 题目描述 最近可口可乐在搞大促销活动,1瓶可乐只要1元钱.而且 ...
- 深入学习之mysql(一)数据库操作
1.显示所有数据库: SHOW DATABASES; 2.创建数据库: CREATE DATABASE 数据库名: 3.选择你所创建的数据库: USE 数据库名; 4.删除数据库: DROP 数据库名 ...
- springboot 连接redis
引入依赖: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>s ...
- ruby 发送邮件
产品构建.打包.部署完需要发送邮件通知相关人员进行验证.请看过程 #encoding:utf-8 require 'mail' #~ branch = ARGV.to_s.sub('[','').su ...
- php中的对象赋值
如果现在问你一个问题: <?php class A{ public $a = 1; } $a = new A(); $b = $a; $b->a = 3; print_r($a->a ...
- h5 video切换到横屏全屏
将video设置为屏幕大小,覆盖其他元素,想到这种操作我也是震惊的 function() { let startIcon = document.getElementById('start-icon') ...
- IHTMLDocument2的所有成员、属性、方法、事件[转]
原文发布时间为:2010-07-01 -- 来源于本人的百度文章 [由搬家工具导入] IHTMLDocument2 InterfaceGets information about the docume ...
- hdu 2732 Leapin' Lizards 最大流 拆点 建图
题目链接 题意 给定一张网格,格子中有些地方有柱子,有些柱子上面有蜥蜴. 每个柱子只能承受有限只蜥蜴从上面经过.每只蜥蜴每次能走到相距曼哈顿距离\(\leq k\)的格子中去. 问有多少只蜥蜴能走出网 ...
- python脚本传递参数
给python程序传递参数 运行python脚本时有时需要执行实传递参数 在linux下: [root@Test ~]# cat /opt/python.py #!/usr/local/bin/pyt ...
- docker下使用DB2
1.查询可安装的db2镜像 benjamin@docker:~$ docker images |grep -i db2 ibmcom/db2express-c latest 7aa154d9b73c ...