PivotOJ

Advertisement 2

시간 제한: 2000ms메모리 제한: 1024MB출처: JOI 2022-2023 본선BOJ 27537

문제

There are NN residents in JOI Kingdom, numbered from 11 to NN. Resident ii (1 ≤ i ≤ N) lives at the coordinate XiX_i on the real line, and its power of influence is EiE_i. It may be the case that more than one residents live at the same coordinate. A resident with a large power of influence has a high advertising potential. But such a resident is careful in buying books.

Rie published a book on informatics. In order to encourage many people to buy copies of the book, she can donate copies of the book to some residents. If she donates a copy of the book to Resident ii (1 ≤ i ≤ N), Resident ii will get a copy of Rie’s book. Moreover, among the residents who did not yet get copies of the book, every resident jj (1 ≤ j ≤ N) satisfying the following condition will buy a copy of the book and get it.

The distance between Resident ii and Resident jj on the real line is less than or equal to EiEjE_i - E_j. In other words, |X_i - X_j| ≤ E_i - E_j is satisfied.

If all the residents read Rie’s book, the Olympiads in Informatics will be greatly recognized. Write a program which calculates the minimum number of residents who will be donated copies of Rie’s book so that all the residents in JOI Kingdom will get copies of Rie’s book.

입력

Read the following data from the standard input.

NN

X1X_1 E1E_1

X2X_2 E2E_2

\vdots

XNX_N ENE_N

출력

Write one line to the standard output. The output should contain the minimum number of residents who will be donated copies of Rie’s book.

예제

예제 1

입력
4
4 2
2 3
3 4
6 5
출력
2

예제 2

입력
3
7 10
10 10
7 10
출력
2

예제 3

입력
10
31447678 204745778
430226982 292647686
327782937 367372305
843320852 822224390
687565054 738216211
970840050 766211141
563662348 742939240
103739645 854320982
294864525 601612333
375952316 469655019
출력
5
코드를 제출하려면 로그인하세요.