아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Requiescat in Pace

시간 제한1초메모리 제한1024 MB

요약
직선으로 주어진 도로와 후보 지점들이 있을 때, 가장 가까운 도로까지의 거리가 최대인 후보 지점을 고른다.
난이도

보통10점 중 5점

유형
기하, 구현
정답자
아직 제출이 없습니다

문제

After P-22’s passing, there was significant discussion about what should happen to his remains. Initially, there was talk of storing them in the Natural History Museum (across from USC), but in the end, it was decided that a native tribe would give him a ritualistic burial at an undisclosed location in the Santa Monica Mountains. Of course, we do not know exactly how they chose the location, but probably, they first collected a few candidate locations, and then picked the best one according to one or more criteria. A natural criterion would be for the location to be far from all roads and hiking trails, so that the burial site would be less likely to be disturbed, and because P-22, while alive, also mostly avoided proximity to humans. Here, you will choose such a candidate location.

You will be given all the trails/roads as straight line segments — curved roads could of course be approximated by a sequence of such segments. You will also be given the candidate burial locations. You are to select the candidate location that maximizes the minimum distance to any point on any trail/road.

입력

The first line is the number 1≤K≤1001 ≤ K ≤ 100 of input data sets, followed by the KK data sets, each of the following form:

The first line of the data set contains two integers 1≤T,L≤10001 ≤ T, L ≤ 1000, the number of trails and the number of candidate locations. This is followed by LL lines, each containing two floating point x(s)_ix^{(s)}\_i, y(s)_iy^{(s)}\_i, the location of the ii-th candidate burial site. Next are T lines, each containing four floating point numbers x(t,1)_jx^{(t,1)}\_j , y(t,1)_jy^{(t,1)}\_j, x(t,2)_jx^{(t,2)}\_j, y(t,2)_jy^{(t,2)}\_j. This means that the jj-th trail/road goes from the point (x(t,1)_j,y(t,1)_j)(x^{(t,1)}\_j, y^{(t,1)}\_j) to (x(t,2)_j,y(t,2)_j)(x^{(t,2)}\_j, y^{(t,2)}\_j) along a straight line. All coordinates will be between −1000000.0-1000000.0 and 1000000.01000000.0.

출력

For each data set, output “Data Set xx:” on a line by itself, where xx is its number.

Then, output the index ii of the burial site that is as far as possible from its closest point on a trail. Our inputs will be such that there will never be any ties, or any near-ties (whose distance to the respective closest trail differs by less than 0.0010.001).

Each data set should be followed by a blank line.

예제1

  1. 예제 1

    입력
    1
    4 3
    0 0
    1.5 1.5
    -2.5 -0.5
    -10 1.6 10 1.6
    -1 -1 1 1
    -2.5 0.5 2.5 0.5
    -3.7 -1 0.5 -0.5
    
    예상 출력
    Data Set 1:
    3