PivotOJ

The short shank; Redemption

시간 제한: 1500ms메모리 제한: 512MB출처: BOI 2021BOJ 21848

문제

Well, that certainly didn’t go as planned: While you managed to avoid the museum’s watchmen, you somehow missed that there were surveillance cameras all over the place. As a consequence, your debut as an art thief turned out to be a total disaster: You were arrested and sentenced to prison.

Because WiFi access in prison is the worst, you want to escape. From many prison dramas, you know that distractions are crucial to any escape plan. Therefore, you decided to set up a prison rebellion as a ploy.

The NN prison cells are aligned along a single hallway. The leftmost cell is number 1, the cell immediately to its right is number 2, and so on. Unfortunately, not all your fellow prisoners join the rebellion as planned. But you could make sure that the prisoner in cell ii is planning to start rebelling at time tit_i, i.e. exactly tit_i seconds from now. Also, whenever a prisoner hears the prisoner immediately to his left rebelling, he will also start rebelling after just one second (unless he is already rebelling, of course). A prisoner who has started rebelling will never stop.

At time TT, the local F.R.U.IT.T.Ar.T. representative will arrive for an inspection. You figure that this will be the perfect time to escape. However, the prison wardens won’t be happy about a rebellion during an inspection. You are afraid they are going to use DD soundproof mattresses that can be installed between cells. If such a mattress is installed between cell i1i - 1 and cell ii, the prisoner in cell ii will not start rebelling before time tit_i regardless of the actions of the prisoner in cell i1i - 1 (or any other prisoner).

Write a program that helps you estimate your chances of success: The program shall compute the minimal number of prisoners who will rebel at time TT if the wardens place the mattresses optimally.

입력

The first line of input contains three integers NN, DD, and TT: the number of prison cells, the number of mattresses, and the time the representative arrives.

The second line contains NN integers tit_i, where tit_i describes the time the prisoner in cell ii is planning to start rebelling.

출력

The only line of output should consist of exactly one integer: the minimal number of prisoners rebelling at time TT.

힌트

An optimal solution to the first sample case would be the following: place a mattress between the second and the third cell. In this case the first, second, fourth, and fifth prisoner will rebel.

예제

예제 1

입력
5 1 42
13 37 47 11 42
출력
4

예제 2

입력
5 2 5
1 9 4 6 7
출력
2
코드를 제출하려면 로그인하세요.