RETO1 - COMPUTADOR LOCO . . .
ZS Coder performs encoding in a crazy team. If a word is entered into the system in an amount c of consecutive seconds, everything written disappears.
More formally, if you have written a word in the second A and then the next word in the second B, then if (B-A) ≤ c, the new word is added to the other words on the screen. If (B-A) > c, then everything on the screen is cleared (after the last word you typed appears on the screen).
For example, if c = 5 and written in the second words 1, 3, 8, 14, 19, 20, after the 8th second, three words will be displayed. After that, everything disappears in the 13th second because nothing has been written before the 5 seconds. In the second 14 and 19 two words are written, and finally, in the second 20, you write a word, and a total of three words remain on the screen.
Yes give the times when the ZS Coder typed words. Determine how many words remain in after having finished writing all the screen.
Spanish version
Input
The first line contains two integers N and C (1 ≤ n ≤ 100000, 1 ≤ c ≤ 109) - the number of words typed ZS Coder and delayed crazy, respectively equipment.
The next line contains n integers t1, t2 ... tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where ti denotes the second when ZS Coder writes the watchword i.
Output
Print a single positive integer, the number of words that remain on the screen after all N words are written, in other words, in the second tn.
Example
Input: 6 5 1 3 8 14 19 20 Output: 3
Input: 6 1 1 3 5 7 9 10 Output: 2
Explanation
The first example is explained in the problem.
For the second example after writing the first word in the second one, it disappears because the next word is written in the second 3 and (3-1) > 1 Similarly to 5, 7 and 9, only one word remains in the second 9. Then, a word is written in the second 10, it remains on the screen because (10-9) ≤ 1
hide comments
Ricardo Langaro:
2017-03-16 23:24:16
acho que este problema esta errado, sem solução |
|
luiz henrique avilla vigiato :
2017-03-15 04:41:01
I need more examples |
Added by: | MaratónAFDM |
Date: | 2016-10-07 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | MAWK BC C NCSHARP CSHARP C++ 4.3.2 CPP14 COFFEE DART FORTH JAVA JS-RHINO JULIA KTLN NODEJS OBJC OCT PHP PROLOG PYTHON PYPY3 PYTHON3 R RACKET SQLITE SWIFT UNLAMBDA |