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

8302번 - Map 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB84211724.638%

문제

Jane has found an old map of her town in her basement. The map is a square-shaped piece of paper divided into unit squares on which several mysterious points are marked. Jane does not know the meaning of these points and that is why she decided to visit each one of them. She decided to meet with 3 of her colleagues - Jack, Adam and Robert - in one of the mysterious points: this will be the starting point. Afterwards each of the persons will be assigned an area in which he/she will find all the mysterious points and check the secrets hidden in them. Jane decided to settle four areas: the first one that consists of all the points with both coefficients less than the coefficients of the starting point, the second one in which both coefficients are greater, the third one in which the first coefficient is greater and the second one is less, and the fourth one in which the first coefficient is less and the second one is greater. In the end all the colleagues will visit together the marked points for which the first or second coefficient equals the corresponding coefficient of the starting point.

Now Jane only needs to choose the starting point. It should be chosen in such a way that each person will visit independently at least one of the mysterious points. Can you find the number of such starting points?

입력

The first line of the standard input contains two integers n and d (1 ≤ n ≤ 1 000 000, 3 ≤ d ≤ 109), denoting the number of points that are marked on the map and the size of the map. The following n lines contain descriptions of the points, each of which has the form of a pair of integers xi, yi (0 ≤ xi, yid), representing the coefficients of the i-th point. All points in the input are distinct.

출력

The first and only line of the standard output should contain a single integer representing the number of points that can become the starting point.

제한

예제 입력 1

6 5
0 0
1 4
2 2
3 2
4 4
5 1

예제 출력 1

2

힌트

출처

Contest > Algorithmic Engagements > PA 2010 4-2번

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

출처

대학교 대회

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

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