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 thanli 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.
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
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 integern (1≤n≤105) ,
the number of soda. The second line constains n integers
【推广】
免费学中医,健康全家人
The first contains an integer
原文地址:https://www.cnblogs.com/cynchanpin/p/6817500.html
- 推荐文章
- js从select列表选项中删除一个Item项
- 静态页面下用javascript操作ACCESS数据库(读增改删)的代码
- 何去何从
- acm牛人
- javascript
- 膜拜Redis
- 什么是BULK INSERT
- Redis性能评测
- SWF 文件不能访问本地资源 只有仅限于文件系统的 SWF 文件和可信的本地 SWF 文件可以访问本地资源。
- MongoDB、HandlerSocket和MySQL性能测试及其结果分析
- BENCHMARKING LIBEVENT AGAINST LIBEV
- BENCHMARKING LIBEVENT AGAINST LIBEV
- QPS,TPS
- HandlerSocket
- EasyMvc入门教程基本控件说明(1)按钮
- EasyMvc入门教程入门
- 订票助手
- EasyMvc入门教程基本控件说明(2)定时器
- 一段Javascript的代码
- 如何判断浏览器的请求头是不是结束
- 插入排序
- JavaMail学习笔记
- Struts2的工作原理
- 我的快速排序
- 截取字符串,只截取前N个字节的字符
- 修改MyEclipse8.6中的Servlet.java模板
- Java类装载的过程及原理介绍
- cmd检查jdk的版本
- 快速排序
- flash 侦测人的面部