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

5890번 - Tractor 다국어

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

문제

After a long day of work, Farmer John completely forgot that he left his tractor in the middle of the field. His cows, always up to no good, decide to play a prank of Farmer John: they deposit N bales of hay (1 <= N <= 50,000) at various locations in the field, so that Farmer John cannot easily remove the tractor without first removing some of the bales of hay.

The location of the tractor, as well as the locations of the N hay bales, are all points in the 2D plane with integer coordinates in the range 1..1000. There is no hay bale located at the initial position of the tractor. When Farmer John drives his tractor, he can only move it in directions that are parallel to the coordinate axes (north, south, east, and west), and it must move in a sequence of integer amounts. For example, he might move north by 2 units, then east by 3 units. The tractor cannot move onto a point occupied by a hay bale.

Please help Farmer John determine the minimum number of hay bales he needs to remove so that he can free his tractor (that is, so he can drive his tractor to the origin of the 2D plane).

입력

  • Line 1: Three space-separated integers: N, and the (x,y) starting location of the tractor.
  • Lines 2..1+N: Each line contains the (x,y) coordinates of a bale of hay.

출력

  • Line 1: The minimum number of bales of hay Farmer John must remove in order to open up a path for his tractor to move to the origin.

제한

예제 입력 1

7 6 3
6 2
5 2
4 3
2 1
7 3
5 4
6 4

예제 출력 1

1

힌트

Input Details

The tractor starts at (6,3). There are 7 bales of hay, at positions (6,2), (5,2), (4,3), (2,1), (7,3), (5,4), and (6,4).

Output Details

Farmer John only needs to remove one bale of hay to free his tractor.

출처

Olympiad > USA Computing Olympiad > 2011-2012 Season > USACO March 2012 Contest > Silver 1번

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

출처

대학교 대회

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

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