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

22594번 - Shelter 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
8 초 (추가 시간 없음) 512 MB87787.500%

문제

Taro lives in a town with N shelters. The shape of the town is a convex polygon.

He’ll escape to the nearest shelter in case of emergency. Given the current location, the cost of escape is defined as the square of the distance to the nearest shelter. Because emergency occurs unpredictably, Taro can be at any point inside the town with the same probability. Calculate the expected cost of his escape.

입력

The first line contains two integers M and N (3 ≤ M ≤ 100, 1 ≤ N ≤ 100), which denote the number of vertices of the town and the number of shelters respectively.

The following M lines describe the coordinates of the vertices of the town in the conunter-clockwise order. The i-th line contains two integers xi and yi (−1000 ≤ xi, yi ≤ 1000), which indicate the coordinates of the i-th vertex. You may assume the polygon is always simple, that is, the edges do not touch or cross each other except for the end points.

Then the following N lines describe the coordinates of the shelters. The i-th line contains two integers xi and yi, which indicate the coordinates of the i-th shelter. You may assume that every shelter is strictly inside the town and any two shelters do not have same coordinates.

출력

Output the expected cost in a line. The answer with an absolute error of less than or equal to 10−4 is considered to be correct.

제한

예제 입력 1

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

예제 출력 1

2.0000000000

예제 입력 2

5 2
2 0
2 2
0 2
-2 0
0 -2
0 0
1 1

예제 출력 2

1.0000000000

예제 입력 3

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

예제 출력 3

0.7500000000

힌트

출처

Contest > ICPC Japanese Alumni Group > JAG Winter Camp > JAG Winter Camp 2011 Day 4 G번

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

출처

대학교 대회

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

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