CF716A.Crazy Computer

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

ZS the Coder is coding on a crazy computer. If you don't type in a word for a cc consecutive seconds, everything you typed disappear!

More formally, if you typed a word at second aa and then the next word at second bb , then if ba<=cb-a<=c , just the new word is appended to other words on the screen. If b-a>c , then everything on the screen disappears and after that the word you have typed appears on the screen.

For example, if c=5c=5 and you typed words at seconds 1,3,8,14,19,201,3,8,14,19,20 then at the second 88 there will be 33 words on the screen. After that, everything disappears at the second 1313 because nothing was typed. At the seconds 1414 and 1919 another two words are typed, and finally, at the second 2020 , one more word is typed, and a total of 33 words remain on the screen.

You're given the times when ZS the Coder typed the words. Determine how many words remain on the screen after he finished typing everything.

输入格式

The first line contains two integers nn and cc ( 1<=n<=100000,1<=c<=1091<=n<=100000,1<=c<=10^{9} ) — the number of words ZS the Coder typed and the crazy computer delay respectively.

The next line contains nn integers t1,t2,...,tnt_{1},t_{2},...,t_{n} ( 1<=t_{1}<t_{2}<...<t_{n}<=10^{9} ), where tit_{i} denotes the second when ZS the Coder typed the ii -th word.

输出格式

Print a single positive integer, the number of words that remain on the screen after all nn words was typed, in other words, at the second tnt_{n} .

输入输出样例

  • 输入#1

    6 5
    1 3 8 14 19 20
    

    输出#1

    3
  • 输入#2

    6 1
    1 3 5 7 9 10
    

    输出#2

    2

说明/提示

The first sample is already explained in the problem statement.

For the second sample, after typing the first word at the second 11 , it disappears because the next word is typed at the second 33 and 3-1>1 . Similarly, only 11 word will remain at the second 99 . Then, a word is typed at the second 1010 , so there will be two words on the screen, as the old word won't disappear because 109<=110-9<=1 .

首页