Maddison's Square Garden
시간 제한6초메모리 제한1024 MB
단위 정사각형 둘레의 두 점을 잇는 직선 경로가 주어질 때, 모든 이동 시간이 제한 안에 남도록 중심 정사각형 정원의 최대 한 변 길이를 구한다.
문제
Maddison and her friends live and work on the perimeter of a unit square with bottom left corner at and top right corner at . They’ve decided to build a square community garden centered at , but they can’t decide how big it should be! The garden can’t rotate, so a garden of side length has corners at
It takes longer to walk through the garden compared to the open space that exists right now, and each of Maddison’s friends have a limit as to how long they are willing to walk to work. They each walk at units per minute in the open space or on the perimeter of the garden, but units per minute through the garden.
Maddison’s friends are also very stubborn. They will always walk in a straight line from home to work, no matter how much the garden slows them down.
Find the largest side length of a square garden centered at such that all of Maddison’s friends can still get to work on time.
입력
The first line of input contains integer () and real number (). Then lines follow, each containing five real numbers where and are points denoting the home and workplace respectively of one of Maddison’s friends and is the maximum number of minutes that friend is willing to take to walk between their home and workplace. The points and are always on the perimeter of the unit square. All real numbers are given with exactly 6 digits of precision after the decimal.
It is guaranteed that all of Maddison’s friends can get to work on time when there is no garden.
출력
Output a single floating-point value () that is the maximum valid side length of Maddison’s Square Garden. Your answer will be considered correct if it is within an absolute error of of the correct answer.