Logo
(追記) (追記ここまで)

25055번 - Il Derby della Madonnina 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 2048 MB121585449.541%

문제

The derby between Milan and Inter is happening soon, and you have been chosen as the assistant referee for the match, also known as linesman. Your task is to move along the touch-line, namely the side of the field, always looking very carefully at the match to check for offside positions and other offences.

Football is an extremely serious matter in Italy, and thus it is fundamental that you keep very close track of the ball for as much time as possible. This means that you want to maximise the number of kicks which you monitor closely. You are able to monitor closely a kick if, when it happens, you are in the position along the touch-line with minimum distance from the place where the kick happens.

Fortunately, expert analysts have been able to accurately predict all the kicks which will occur during the game. That is, you have been given two lists of integers, $t_1,ドル $\dots,ドル $t_n$ and $a_1,ドル $\dots,ドル $a_n,ドル indicating that $t_i$ seconds after the beginning of the match the ball will be kicked and you can monitor closely such kick if you are at the position $a_i$ along the touch-line.

At the beginning of the game you start at position 0ドル$ and the maximum speed at which you can walk along the touch-line is $v$ units per second (i.e., you can change your position by at most $v$ each second). What is the maximum number of kicks that you can monitor closely?

입력

The first line contains two integers $n$ and $v$ (1ドル ≤ n ≤ 2 · 10^5,ドル 1ドル ≤ v ≤ 10^6$) — the number of kicks that will take place and your maximum speed. The second line contains $n$ integers $t_1,ドル $\dots,ドル $t_n$ (1ドル ≤ t_i ≤ 10^9$) — the times of the kicks in the match. The sequence of times is guaranteed to be strictly increasing, i.e., $t_1 < t_2 < \cdots < t_n$. The third line contains $n$ integers $a_1,ドル $\dots,ドル $a_n$ ($-10^9 ≤ a_i ≤ 10^9$) — the positions along the touch-line where you have to be to monitor closely each kick.

출력

Print the maximum number of kicks that you can monitor closely.

제한

예제 입력 1

3 2
5 10 15
7 17 29

예제 출력 1

2

Explanation of sample 1.

It is possible to move to the right at maximum speed for the first 3ドル.5$ seconds and stay at position 7ドル$ until the first kick happens, and then immediately move right also at maximum speed to watch the second kick at position 17ドル$. There is no way to monitor closely the third kick after the second kick, so at most 2ドル$ kicks can be seen.

예제 입력 2

5 1
5 7 8 11 13
3 3 -2 -2 4

예제 출력 2

3

예제 입력 3

1 2
3
7

예제 출력 3

0

힌트

출처

ICPC > Regionals > Europe > Southwestern European Regional Contest > SWERC 2021-2022 C번

  • 문제를 만든 사람: Gerard Orriols
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /