LCC '25 Contest 1 J4 - Candy Delivery
View as PDFNightlqht, the other MCPT president, owns the most popular candy factory in the city! He has recently opened his delivery service, but unbeknownst to him, all his ghostly delivery drivers seem to have vanished! He has to resort to his latest machine: The CandyFlare.
The instructions of the CandyFlare are as follows:
Aim the CandyCannon (which shoots CandyFlares) in the direction you want.
Press the big red launch button (NOT THE NUCLEAR MISSILE ONE!!!).
Watch as it sails straight like an arrow to infinity while dropping candy along its path.
The city can be modeled using coordinates relative to Nightlqht's factory (which is located at .) There are
houses that require candy delivery, and each house is located at a distinct point
. What is the minimum number of flares that he needs to send for each house to receive candy?
Subtasks
Subtask 1 [20%]
Subtask 2 [30%]
Subtask 3 [50%]
No further subtasks.
Input Specification
The first line will contain the integer .
Each of the next lines will contain space-separated integers
, the coordinates of the
house.
Output Specification
Output a single integer indicating the minimum number of flares that need to be shot for all houses to receive candy from them.
Sample Input
4
2 2
1 2
3 3
-4 -8
Sample Output
3
Explanation for Sample Output
By sending a flare along the line towards Quadrant I, the flare will pass over houses at
and
. We must send 2 flares along the line
, one towards Quadrant I and one towards Quadrant III. This is because the flare begins at the factory, which is at the origin.
Comments