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

22245번 - Boats 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB55121227.273%

문제

Magicians have to come to the great assembly of Aglargond School of Magic. They can come with boats, among other ways. Organizers have reserved a ring for every participant, so he can tie his boat to the ring assigned uniquely to him. Every magician has sent the length of his boat to the organizers. The boat has to be tied so that the ring is somewhere on the length of the boat including endpoints of the boat. End of the boats can touch each other, but boats cannot overlap (see the picture). Because of this restriction it is possible that all boats cannot be tied at the same time. Organizing committee of the Magician Assembly asked you to write the program that finds the maximal number of the boats which can be tied at the same time to the assigned rings.

Allowed Not allowed

입력

The first line of input contains number of magicians, N (1 ≤ N ≤ 10000). In each of the following N lines there are exactly two space separated integers li and pi (1 ≤ li, pi ≤ 100000, 1 ≤ i ≤ N) representing the length of the boat and the position of the assigned ring along the river bank starting from the school building. No two rings have the same position.

출력

The output has exactly one line containing one number – maximal number of boats.

제한

예제 입력 1

7
5 9
2 17
6 10
3 11
2 16
4 13
5 6

예제 출력 1

5

힌트

출처

Olympiad > Balkan Olympiad in Informatics > Junior Balkan Olympiad in Informatics > JBOI 2007 4번

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

출처

대학교 대회

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

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