CF6E--Exposition译文

原题链接--

https://acs.jxnu.edu.cn/problem/CF6Eicon-default.png?t=M0H8https://acs.jxnu.edu.cn/problem/CF6E 

Exposition

 1000ms  65536K

描述:

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. The height of each book in millimeters is know, it is hi. As Berlbury is highly respected in the city, the organizers want to include into the exposition as many books as possible, and to find out what periods of his creative work they will manage to cover. You are asked to help the organizers cope with this hard task.

译文:距离著名作家伯尔布里的50岁生日还有几天。在这方面,当地图书馆决定为这位著名科幻小说家的作品办一个博览会。同时也决定只有那些在特定时期出版的书才有必要列入博览会。很明显如果这些书的大小差别很大,游客们不会喜欢。这就是为什么组织者认为,展览中最高和最低的书籍之间的差别,应该不超过 k 毫米。

图书馆有n卷伯尔布里的书,按照出现的时间顺序排列。每本书按毫米计算的高度已知,为hi。因为伯尔布里在城市中受人尊敬,组织者想把尽可能多的书列入博览会,并找出计划列入的作品覆盖多长时期。组织者询问你来应对这个问题。

输入:

The first line of the input data contains two integer numbers separated by a space n (1 ≤ n ≤ 105) and k (0 ≤ k ≤ 106) — the amount of books by Berlbury in the library, and the maximum allowed height difference between the lowest and the highest books. The second line contains n integer numbers separated by a space. Each number hi (1 ≤ hi ≤ 106) is the height of the i-th book in millimeters.

译文:第一行输入数据包含两个由空格分隔的整数n(1 ≤ n ≤ 105)和k(0 ≤ k ≤ 106)—伯尔布里在图书馆的书的数量和最高和最低的书籍最大允许的高度差。第二行包含n个由空格分隔的整数。每个数hi (1 ≤ hi ≤ 106)是第i本书的高度。

输出:

In the first line of the output data print two numbers a and b (separate them by a space), where a is the maximum amount of books the organizers can include into the exposition, and b — the amount of the time periods, during which Berlbury published a books, and the height difference between the lowest and the highest among these books is not more than k milllimeters.

In each of the following b lines print two integer numbers separated by a space — indexes of the first and the last volumes from each of the required time periods of Berlbury's creative work.

译文:第一行输出两个数a和b(由空格分隔),a是列入博览会的书的最大数量,b是作品跨越的时间段,在此期间伯尔布里出版了a本书,最高和最低的书籍的高度差不多于k毫米。

接下来b行输出两个由空格分隔的整数,伯尔布里创作作品所在时间段的第一卷和最后一卷的下标。

样例输入:

3 3
14 12 10

样例输出:

2 2
1 2
2 3

样例输入:

2 0
10 10

样例输出:

2 1
1 2

样例输入:

4 5
8 19 10 13

样例输出:

2 1
3 4

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值