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

Problem Description
There are n soda
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.
 
Input
There are multiple test cases. The first line of input contains an integer T,
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(优先队列)的更多相关文章

  1. hdu 5360 Hiking(优先队列+贪心)

    题目:http://acm.hdu.edu.cn/showproblem.php? pid=5360 题意:beta有n个朋友,beta要邀请他的朋友go hiking,已知每一个朋友的理想人数[L, ...

  2. 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 ...

  3. 2015多校第6场 HDU 5360 Hiking 贪心,优先队列

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5360 题意:给定n个人,现在要邀请这些人去远足,但每个人同意邀请的条件是当前已经同意去远足的人数c必须 ...

  4. HDU 5360——Hiking——————【贪心+优先队列】

    Hiking Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Su ...

  5. HDU 5360 Hiking 登山 (优先队列,排序)

    题意: 有n个人可供邀请去hiking,但是他们很有个性,每个人都有个预期的人数上下限[Li,Ri],只有当前确定会去的人数在这个区间内他才肯去.一旦他答应了,无论人数怎样变更,他都不会反悔.问最多能 ...

  6. HDOJ 5360 Hiking 优先队列+贪心

    原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=5360 题意: 大概的意思就是每个人有个人数接受范围$[l_i,r_i]$,现在你每次能从还未被选取的人 ...

  7. 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 ...

  8. HDU 5360 Hiking (贪心)

    题意:邀请 n 参加聚会,如果在邀请第 i 个人之前,已经成功邀请了 x 个人,并且 li <= x <= ri,那么第 i 人才会去,问你怎么排列使得邀请的人最多. 析:对于所有的人,按 ...

  9. HDU 5360 【优先队列+贪心】

    题意: 给定N个无序区间. 对合法区间的定义是: 在这个区间之前已经选出了至少l个合法区间,最多选出了r个合法区间.则该区间为合法区间. 输出最多能挑选出多少个合法区间,并输出合法区间的数量. 思路: ...

随机推荐

  1. 基于web自动化测试框架的设计与开发(讲解演示PPT)

  2. Django中前端界面实现级联查询

    Django前端界面实现级联查询 一.前端界面中 <span scope="col" colspan="6"> 院系:<select id=& ...

  3. hnust 懒人多动脑

    问题 F: 懒人得多动脑 时间限制: 1 Sec  内存限制: 128 MB提交: 93  解决: 30[提交][状态][讨论版] 题目描述 小D的家A和学校B都恰好在以点F为焦点的双曲线上,而小D每 ...

  4. gcc学习记录2——多输入文件

    首先有两个.c文件:circle.c和circulararea.c. 分别对两个源文件生成目标文件,circle.o和circulararea.o. gcc -c circle.c circularr ...

  5. sql执行效率 Explain

    explain+sql语句 explain返回的结果项很多,这里我们只关注三种,分别是type,key,rows. key:显示MySQL实际决定使用的键(索引).如果没有选择索引,键是NULL. r ...

  6. 习题:过路费(kruskal+并查集+LCA)

    过路费  [问题描述]在某个遥远的国家里,有 n 个城市.编号为 1,2,3,…,n.这个国家的政府修 建了 m 条双向道路,每条道路连接着两个城市.政府规定从城市 S 到城市 T 需 要收取的过路费 ...

  7. 【bzoj3091】城市旅行 LCT区间合并

    题目描述 输入 输出 样例输入 4 5 1 3 2 5 1 2 1 3 2 4 4 2 4 1 2 4 2 3 4 3 1 4 1 4 1 4 样例输出 16/3 6/1 题解 LCT区间合并 前三个 ...

  8. HDU 4845 拯救大兵瑞恩(分层图状压BFS)

    拯救大兵瑞恩 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Sub ...

  9. MySQL的InnoDB的细粒度行锁,是它最吸引人的特性之一。

    MySQL的InnoDB的细粒度行锁,是它最吸引人的特性之一. 但是,如<InnoDB,5项最佳实践>所述,如果查询没有命中索引,也将退化为表锁. InnoDB的细粒度锁,是实现在索引记录 ...

  10. 文件处理.Windows.Fastcopy.3.50.x64.文件复制简体中文破解版(验证版)

    摘要:Fastcopy 3.50 + x64 绿色汉化中文版由知索网汉化发布.Fastcopy 是一款来自日本的最快的文件拷贝工具.磁盘间相互拷贝文件是司空见惯的事情,通常情况都是利用 WINDOWS ...