首页 > 代码库 > HDU 5360 Hiking(优先队列)
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
Problem Description
There are soda
conveniently labeled by .
beta, their best friends, wants to invite some soda to go hiking. The -th
soda will go hiking if the total number of soda that go hiking except him is no less than and
no larger than .
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 and no larger than , 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.
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 and no larger than , 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 ,
indicating the number of test cases. For each test case:
The first contains an integer , the number of soda. The second line constains integers
The first contains an integer , the number of soda. The second line constains integers
HDU 5360 Hiking(优先队列)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。