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

30820번 - See the Sights on the Flights 스페셜 저지다국어

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

문제

Dima is an architect. He is also a photographer. He spends his time on travelling around the world and making photos of cool buildings like Big Ben etc.

This time Dima went to Berland famous with its subway system. It consists of $n$ lines, each of which is represented with a line on the map of the city. For any two lines there is a subway station in their intersection point, those station entrances are considered to be the notable pieces of architecture. Dima decided to take a photo of them.

In order to take the panoramic photo, he is going to use a helicopter flight. Helicopter may use one of the $t$ routes. Each route is also represented with a line on the map of the city. Dima is able to make a photo from an arbitrary point of the route, though the smaller distance from his location to the station means the better photo and the larger number of likes he is going to receive in social networks. That's why Dima needs your help.

You are given $n$ descriptions of the subway lines and $t$ lines defining the helicopter routes. For each of the helicopter routes Dima asks you to find the distance to the closest subway station.

It is guaranteed that no two subway lines coincide, any two subway lines have a common point, any two routes have a common point and each route has exactly one common point with each subway line.

입력

In the first line of the input there are two integers $n,ドル $t$ (2ドル \le n \le 100,000円,ドル 1ドル \le t \le 20$) --- the number of subway lines and the number of helicopter routes, respectively.

In each of the following $n$ lines there are three integers $a_i,ドル $b_i$ and $c_i$ ($|a_i|, |b_i| \le 10,000円,ドル $a_i^2+b_i^2>0,ドル $|c_i| \le 10^8$) defining each of the subway lines. The corresponding line is defined by the equation $a_i\cdot x + b_i \cdot y + c_i = 0$.

In each of the following $t$ lines there are three integers $u_i,ドル $v_i,ドル $w_i$ ($|u_i|, |v_i| \le 10,000円,ドル $u_i^2+v_i^2 > 0,ドル $|w_i| \le 10^8$) defining each of the helicopter routes. Similarly, each route is defined with the equation $u_i \cdot x + v_i \cdot y + w_i = 0$.

출력

For each route output the only real number --- the distance between $i$-th helicopter route and its most closest subway station. Your answer will be considered correct if the absolute or relative error between your answer and the answer of the jury doesn't exceed 10ドル^{-9}$. Namely, $\frac{|p-j|}{\max(1,j)} \leq 10^{-9}$ where $p$ is your answer and $j$ is the answer of the jury.

제한

예제 입력 1

3 1
1 -1 0
1 1 -4
4 -6 -4
0 1 0

예제 출력 1

1.2

예제 입력 2

3 3
1 3 -6
-1 1 0
-5 2 15
3 -2 -3
-1 -1 4
1 0 -5

예제 출력 2

0.41602514717
0.16637806616
0.0

노트

The pictures for the samples are provided below.

출처

Olympiad > Moscow Open Olympiad in Informatics > Moscow Open Olympiad in Informatics 2015-16 > Day 2 Moose번

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

출처

대학교 대회

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

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