WiFi
InterviewTime limit1sMemory limit512 MB
Given the study room's public WiFi and each room's hotspot, compute the public signal speed in every room and print the maximum, or IMPOSSIBLE if none is positive.
- Level
Easy3 of 10
- Topics
- Implementation, Math, Brute force, Geometry
- Solved
- No attempts yet
Problem
Wooseok does not want to leave his room even to go to the nearby small study room, so he wants to use WiFi from his room. The small study room has its own public WiFi, but students who were unhappy with its speed turned on hotspot WiFi, and those signals interfered with the study room's WiFi signal. Wooseok wants to estimate the speed of the public WiFi he can use despite the interference.
There are rooms, numbered to , and the position of each room and of the small study room can be represented as a point on a 2D plane. Room is at , and the small study room is at .
The speed of the study room's WiFi reaching each room is computed as follows.
- The small study room has a public WiFi turned on with energy .
- Each room has at most one hotspot WiFi turned on.
- If , a hotspot WiFi with energy is turned on; if , no hotspot WiFi is turned on.
- The strength of a WiFi signal decays from its energy by the taxicab distance between where the WiFi is turned on and where the WiFi is used, and it does not decay below .
- That is, when a WiFi with energy turned on at reaches , its strength is .
- The WiFi speed reaching room is the strength of the public WiFi reaching room minus the sum of the strengths of all hotspot WiFi signals reaching room .
- If the WiFi speed is or less, WiFi cannot be connected in room .
Bold Wooseok can break into other rooms if it means getting WiFi. For Wooseok, find the public WiFi speed of the room with the fastest public WiFi.
Input
The first line gives the number of rooms .
Of the following lines, the -th line gives , , separated by spaces.
Output
Print the speed in the room with the fastest public WiFi. If no room can connect to the public WiFi, print "IMPOSSIBLE" (without quotes).
Constraints
- ()
- ()
- All numbers in the input are integers.
Hint
Note that even in the same room, a hotspot WiFi that is turned on interferes with the public WiFi signal.