HDU 5360 Hiking(优先队列)
2024-08-28 19:35:14
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.
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
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;
最新文章
- RNN 入门学习资料整理
- source导入错码解决办法
- mstsc命令详解
- pfx 转 snk
- Android Butterknife框架配置
- git warning: LF will be replaced by CRLF in 解决办法
- 使用JavaScript判断图片是否加载完成的三种实现方式
- [Jobdu] 题目1517:链表中倒数第k个结点
- IT薪酬
- .net中的4种事务总结
- linux下安装redis和phpredis扩展
- 操作MongoDB数据库知识点
- 系统功能调用Windows操作系统原理实验
- 【ocp新题】OCP 12c 062认证考试出现大量新题-8
- 20181123_控制反转(IOC)和依赖注入(DI)
- LOJ #6022. 重组病毒
- 在Ubuntu上安装Arena
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)-mysql.sock丢失解决方案
- 第15篇 PSR-04 规范
- 《Deep Learning》第二章 线性代数 笔记