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

6862번 - Tin Can Telephone 다국어

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

문제

Romy and Jules have been talking with each other on their cell phones. Unfortunately, their parents dislike each other and have decided that they can no longer call each other. In fact, their parents have taken their cell phones away. So, Romy and Jules must find some other way to communicate. After searching the web for ideas, they have decided to build a “tin can” telephone.

Simply, a tin can telephone is two empty soup cans attached to each other with a string. To use it, the string must be stretched tight and then one person speaks while the other person listens. It is important that nothing touches the string so that it can vibrate and transfer sound from one can to the other.

To successfully set up a tin can telephone, Romy and Jules are going to need a clear line of sight between their two bedroom windows. To determine if they can run the string between their rooms, they get out a map that uses simple integer coordinates. Now consider the following three situations.

In these figures, “Romy” is Romy’s window (the grid coordinates 0,0) and “Jules” is Jules’ window (grid coordinates 3,3). In the first figure, there is a building between their windows, and it blocks the line of sight between them. In the second figure, the building doesn’t block their view and they can successfully set up a tin can phone. In the third figure, a line drawn from Romy’s coordinates to Jules’ coordinates would touch the corner of the building. Since the string cannot touch anything, they cannot set up a tin can telephone and the view is considered as blocked.

입력

The input begins with a line containing four integer coordinates representing the locations of Romy’s and Jules’ windows. That is, the input xR yR xJ yJ represents the coordinates (xR, yR) for Romy’s window, and the coordinates (xJ, yJ) for Jules’ window. You may assume that -1000 ≤ xR, xJ ≤ 1000 and -1000 ≤ yR, yJ ≤ 1000. The next line contains a single integer, n (0 ≤ n ≤ 100), identifying the number of buildings that will follow on the next n lines. Each building is on a separate line and begins with an integer specifying the number of corners that the building has. This integer is followed by the integer coordinates of the building’s corners, in either clockwise or counter-clockwise order. No building has more than 32 corners. The sample input and output, shown below, corresponds to the first “blocked” situation described previously.

출력

For the input data, output a single number identifying the number of buildings that touch or block the line of sight.

제한

예제 입력 1

0 0 3 3
1
4 1 2 2 2 2 1 1 1

예제 출력 1

1

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2006 > CCC 2006 Senior Division 3번

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

출처

대학교 대회

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

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