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

26453번 - Underground's SUNDAY 스페셜 저지다국어

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

문제

JAG Kingdom is a dimly lit country located underground. Sunlight doesn't usually reach JAG Kingdom, but there is one day every few years when sunlight reaches it: SUNDAY. On that day, the sun passes directly above a single hole in the "ceiling" of JAG Kingdom, and the sun peeks out. Bob, the boy in JAG Kingdom, is wondering how much time he can see all of the sun through the hole on the next SUNDAY. Please help him.

The ceiling of the JAG Kingdom is represented by a two-dimensional plane. The sun is represented by a circle of radius $R,ドル and its center moves straight from $(-10^{100}, 0)$ to $(10^{100}, 0)$ by 1ドル$ per unit time. The hole is represented by a simple polygon in the two-dimensional plane. Your task is to find the total time that the circle is contained within the polygon. A circle is contained in a polygon if and only if any point inside or on the circumference of the circle is contained inside or on the circumference of the polygon.

입력

The input consists of a single test case of the following format.

$N$ $R$

$x_1$ $y_1$

$\vdots$

$x_N$ $y_N$

The first line contains two integers $N$ and $R$ (3ドル ≤ N ≤ 10^5,ドル 1ドル ≤ R ≤ 10^6$) separated by a space, which represent the number of vertices of the polygon and a radius of the circle. Each of the next $N$ lines contains two integers $x_i$ and $y_i$ ($-10^6 ≤ x_i, y_i ≤ 10^6$) separated by a space, which represent the $i$-th vertex of the polygon. The polygon is guaranteed to be simple. In other words, no two edges of the polygon intersect each other.

출력

Print the total time that the circle is contained within the polygon. The answer will be considered as correct if the values output have an absolute or relative error less than 10ドル^{-5}$.

제한

예제 입력 1

4 5
-5 -5
5 -5
5 5
-5 5

예제 출력 1

0.0000000000

예제 입력 2

4 5
-10 -10
10 -10
10 10
-10 10

예제 출력 2

10.000000000

예제 입력 3

9 10
-100 -80
-90 130
-30 150
0 160
100 130
120 90
110 -60
80 -100
0 -120

예제 출력 3

190.1569477022

힌트

출처

Contest > ICPC Japanese Alumni Group > JAG Practice Contest for ICPC Asia Regional > JAG Practice Contest for ICPC 2021 Asia Yokohama Regional E번

Camp > Petrozavodsk Programming Camp > Winter 2023 > Day 1: JAGain in Petrozavodsk E번

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

출처

대학교 대회

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

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