#D. [POI 2010] PIL-Pilots

    Type: RemoteJudge 1000ms 125MiB

[POI 2010] PIL-Pilots

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目背景

POI 2010 Round III - day 2 Pilots.

题目描述

给定 n,kn, k 和一个长度为 nn 的序列,求最长的最大值最小值相差不超过 kk 的子段。

输入格式

第一行两个由空格隔开的整数 k,nk, n0k2×1090\leq k\leq 2\times 10 ^ 91n3×1061\leq n\leq 3\times 10 ^ 6),kk 表示设定的极差的最大值,nn 表示序列的长度。

第二行 nn 个由空格隔开的整数 aia_i1ai2×1091\leq a_i\leq 2\times 10^ 9)表示序列。

输出格式

一个整数表示符合条件的子段的长度最大值。

3 9
5 1 3 5 8 6 6 9 10
4

提示

样例解释:5,8,6,65, 8, 6, 68,6,6,98, 6, 6, 9 都是满足条件长度为 44 的子段。


作者:Piotr Chrząstowski

初二竞赛组——单调队列

Not Claimed
Status
Done
Problem
6
Open Since
2024-9-11 9:00
Deadline
2024-9-26 23:59
Extension
24 hour(s)