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

30138번 - Playing Field 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB654100.000%

문제

My kid's school cleared a large field on their property recently to convert it into a playing area. The field is polygonal. The school administration decided to separate the field into two areas by building a straight picket fence between the area for the older kids and the area for the younger kids. The fence would go between two non-adjacent vertices of the polygonal field, and given the shape of the field, all such possible fences would lie strictly and entirely within the field.

Naturally, the smaller of the two areas would go to the younger kids. So can you help the school determine what the area of the smaller play-area would be for different fence positions?

입력

The first line contains 2 numbers N denoting the number of points in the convex polygon and Q denoting the number of possible locations of straight line fences.

The next N lines contain 2 integers each. The ith line contains the integers xi yi denoting the coordinates of the ith point of the polygon. The points are given in clockwise order.

The next Q lines contain 2 integers a b denoting that a straight line fence is to be drawn connecting a and b.

출력

Output Q lines one corresponding to each query. For each query, output the area of the smaller region for the corresponding query rounded to 1 decimal place. Always have 1 digit after the decimal place, so if the answer is 1, output it as 1.0 instead. Always have at least one digit before the decimal point also.

제한

  • 4 ≤ N ≤ 50000
  • 1 ≤ Q ≤ 50000
  • -20,000,000 ≤ x,y ≤ 20,000,000
  • 0 ≤ a < b-1
  • b < N

예제 입력 1

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

예제 출력 1

0.5
0.5

힌트

The polygon is given by the points (0,0) (0,1) (1,2) (1,0).

In the first query, we join the points (0,1) and (1,0) which leads to the 2 areas given by (0,0) (0,1) (1,0) and (0,1) (1,2) (1,0). The first triangle has an area of 0.5 and the second triangle has an area of 1. The minimum of these 2 is 0.5.

In the second query, we join the points (0,0) and (1,2) which leads to the 2 areas given by (0,0) (0,1) (1,2) and (0,0) (1,2) (1,0). The first triangle has an area of 0.5 and the second triangle has an area of 1. The minimum of these 2 is 0.5.

출처

ICPC > Regionals > Asia West Continent > India > The 2010 ACM-ICPC Asia Amritapuri Regional Contest A번

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

출처

대학교 대회

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

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