Completed Start: 10 Nov 2024, 09:00 End: 10 Nov 2024, 13:00 Timezone: Asia/Almaty
Dividing the stars
10s
1GiB
Neutron stars and giant stars are marked on a flat map. No three stars lie on one straight line. The number n is given. The next n lines contain the coordinates of the neutron stars (2 real numbers separated by a space), and the following n lines contain the coordinates of the giant stars (2 real numbers separated by a space).
Draw a line y = ax + b that passes through one neutron star and one giant star such that, if you count the stars in one of the half-planes, the number of neutron stars equals the number of giant stars. It is guaranteed that a solution of the form y = ax + b exists.
Output a and b separated by a space.
Constraints: 1 < n < 10^5. The coordinates of a star are real numbers greater than 0 and less than 10^6.