codeforces 6E. Exposition(RMQ + 二分)

博客介绍了如何解决Codeforces上的6E问题,即在给定高度差限制k的情况下,找出能放入展览的最大数量的书籍及对应的区间。通过使用RMQ快速查询区间最大值和最小值,再采用二分搜索找到满足条件的最大区间长度。
摘要由CSDN通过智能技术生成
E. Exposition
time limit per test
1.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

There are several days left before the fiftieth birthday of a famous Berland's writer Berlbury. In this connection the local library decided to make an exposition of the works of this famous science-fiction writer. It was decided as well that it is necessary to include into the exposition only those books that were published during a particular time period. It is obvious that if the books differ much in size, the visitors will not like it. That was why the organizers came to the opinion, that the difference between the highest and the lowest books in the exposition should be not more than k millimeters.

The library has n volumes of books by Berlbury, arranged in chronological order of their appearance.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值