RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
문제 ICPC00123

C. Il Derby della Madonnina

설명

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 tou\(ch-li\)ne, 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 tou\(ch-li\)ne 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}\), . . . , \(t_{n}\) and \(a_{1}\), . . . , \(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 tou\(ch-li\)ne. At the beginning of the game you start at position 0 and the maximum speed at which you can walk along the tou\(ch-li\)ne 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 \le n \le 2 \cdot 10^{5}\), \(1 \le v \le 10^{6}\)) — the number of kicks that will take place and your maximum speed. The second line contains \(n\) integers \(t_{1}\), . . . , \(t_{n}\) (\(1 \le t_{i} \le 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}\) < · · · < \(t_{n}\). The third line contains \(n\) integers \(a_{1}\), . . . , \(a_{n}\) (−\(10^{9} \le a_{i} \le 10^{9}\)) — the positions along the tou\(ch-li\)ne 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
출력
2
예제 2
입력
5 1
5 7 8 11 13
3 3 -2 -2 4
출력
3
예제 3
입력
1 2
3
7
출력
0
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC SWERC 2021

평가 및 의견

C. Il Derby della Madonnina

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

C. Il Derby della Madonnina

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8