포럼
문제 ICPC00171

A. Assigning Workstations

설명

Penelope is part of the admin team of the newly built supercomputer. Her job is to assign workstations to the researchers who come here to run their computations at the supercomputer.

Penelope is very lazy and hates unlocking machines for the arriving researchers. She can unlock the machines remotely from her desk, but does not feel that this menial task matches her qualifications. Should she decide to ignore the security guidelines she could simply ask the researchers not to lock their workstations when they leave, and then assign new researchers to workstations that are not used any more but that are still unlocked. That way, she only needs to unlock each workstation for the first researcher using it, which would be a huge improvement for Penelope.

Unfortunately, unused workstations lock themselves automatically if they are unused for more than \(m\) minutes. After a workstation has locked itself, Penelope has to unlock it again for the next researcher using it. Given the exact schedule of arriving and leaving researchers, can you tell Penelope how many unlockings she may save by asking the researchers not to lock their workstations when they leave and assigning arriving researchers to workstations in an optimal way? You may assume that there are always enough workstations available.

제약
입력 형식

The input consists of:
- one line with two integers \(n\) (\(1 \leq n \leq 300\,000\)), the number of researchers, and \(m\) (\(1 \leq m \leq 10^8\)), the number of minutes of inactivity after which a workstation locks itself;
- \(n\) lines each with two integers \(a\) and \(s\) (\(1 \leq a, s \leq 10^8\)), representing a researcher that arrives after \(a\) minutes and stays for exactly \(s\) minutes.

출력 형식

Output the maximum number of unlockings Penelope may save herself.

예제 1
입력
3 5
1 5
6 3
14 6
출력
2
예제 2
입력
5 10
2 6
1 2
17 7
3 9
15 6
출력
3
문제 정보

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

출처 ICPC NWERC 2015

평가 및 의견

A. Assigning Workstations

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

Log in to rate problems.

개별 의견

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

풀이 제출

A. Assigning Workstations

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