Orbit
Time limit2sMemory limit256 MB
Place two opposite sensors on the radius-R circle so their brightest-star readings match, and print the pair with the smallest angle.
- Level
Hard9 of 10
- Topics
- Geometry, Math, Binary search
- Solved
- No attempts yet
Problem
In this universe every celestial body is a point of a plane, and the Earth is the point . The universe holds stars. Star sits at and its luminosity is . No star ever moves, and the universe holds nothing besides the bodies named here.
Two deep space sensors will be placed on the orbit of radius around the Earth, so each sensor sits at distance from . A star of luminosity at distance from a point produces the brightness at that point, and the brightness a sensor observes is the largest of the brightnesses that the stars produce at its position. The distance between and is . The sensors, the Earth and the stars are points of negligible size.
The two sensors must observe the same brightness, and among the placements that meet that condition the distance between the sensors must be as large as possible. Two points of the orbit are never farther apart than , and a pair at distance exactly with equal observed brightness always exists, so the two sensors face each other across the Earth.
Write the first sensor at with . The second sensor is then . Several values of can satisfy the condition, so report the smallest one.
Input
The first line has two integers and , the number of stars and the radius of the orbit, separated by one space. Each of the next lines has three integers , , : the coordinates and the luminosity of star . , and use the same unit.
Output
Print four real numbers , , , on one line, separated by single spaces: the position of the first sensor and the position of the second sensor. Round every number to exactly 6 digits after the decimal point. Here is the smallest angle in at which the two sensors observe the same brightness, and . Print a rounded value of zero as 0.000000, never as -0.000000.
Limits
- Every number in the input is an integer.
Hint
Let be the brightness observed at and let be the distance from that point to star . Then , so comparing with is the same as comparing with . The difference of the two minima is continuous in and takes opposite values at and at , so it is zero for at least one in .