Limits 2s, 512 MB

A 2D grid consists of a lot of special lights bulbs, which turns on upon the incidence of a laser light. Each bulb has a specific coordinate and initially all of them are turned off. Now, you are given a super power, where you can place a laser light in the grid for once. Laser light goes in a straight line. You want to put the laser light in such a way, that you can turn on maximum number of light bulbs. The laser light must pass through (0,0)(0, 0) point. So, before placing the laser you want to write a program to find out the maximum number of lights that can be turned on.


First line will have the number of bulbs, LL (0<L<1070 < L < 10^7). Each of the next LL lines will contain two numbers xx (106x106-10^6 \le x \le 10^6) and yy (106y106-10^6 \leq y \leq 10^6), which represents the coordinate of a bulb.


Print a number which is the maximum number of turned on bulbs.


1 1
2 2
3 3
5 3
-4 -3


Login to submit.



56% Solution Ratio
sourav_hossainEarliest, Nov '18
ShimolFastest, 0.1s
Drag0nFlyLightest, 131 kB
white_monsterShortest, 189B
Toph uses cookies. By continuing you agree to our Cookie Policy.