题目描述
Problem Description
In Tenkaichi Kingdom, a test firing of a railgun (ElectroMagneticLauncher) is conducted as a result of weapon development.
In the test firing, an experiment is conducted to penetrate all $ N $ iron plates placed as obstacles.
At the design stage, the railgun has the power to penetrate any number of obstacles.
However, firing a projectile using the railgun requires a tremendous amount of power.
Daiki-kun is tasked with calculating the minimum number of shots needed to destroy all obstacles in advance.
Additionally, the railgun has also been developed with a dedicated mount, allowing it to be fired in any direction.
For simplicity, the obstacles are represented as line segments on a plane, and the railgun is represented as the origin $ (0, 0) $.
The trajectory of the fired projectile is represented as a half-line extending from the origin, destroying all obstacles it intersects or touches.
By firing in the direction of the red line, it is possible to destroy them in 2 shots.
Since two obstacles touch the red line, they can be destroyed in 1 shot.
By firing in the direction of the red line, it is possible to destroy them in 4 shots.
Input Format
The input is given from the standard input in the following format:
$ N $ $ X_{1,1} $ $ Y_{1,1} $ $ X_{1,2} $ $ Y_{1,2} $ $ X_{2,1} $ $ Y_{2,1} $ $ X_{2,2} $ $ Y_{2,2} $ : $ X_{N,1} $ $ Y_{N,1} $ $ X_{N,2} $ $ Y_{N,2} $
- The first line contains the number of obstacles $ N $ ( $ 1 ≦ N ≦ 2000 $ )
- From the second line to the $ N $th line, four integers ( $ -1000 ≦ X_{i,1}, Y_{i,1}, X_{i,2}, Y_{i,2} ≦ 1000 $ ) are given, where the $ i $th line represents the endpoints of the $ i $th obstacle as $ (X_{i,1}, Y_{i,1}) $ and $ (X_{i,2}, Y_{i,2}) $
- Obstacles (including their endpoints) do not touch the origin
- Obstacles (including their endpoints) do not intersect or touch each other
Output Format
Output the number of test shots required to destroy all obstacles in one line. End the output with a newline.
Sample Input and Output
Sample Input #1
2
10 10 10 -10
-10 10 -10 -10
Sample Output #1
2
Sample Input #2
2
5 -10 5 0
10 0 10 10
Sample Output #2
1
Sample Input #3
8
1 5 6 1
6 -1 1 -6
-1 -6 -5 -1
-5 1 -1 5
7 5 7 -6
-5 -7 6 -7
-6 -6 -6 5
-5 6 6 6
Sample Output #3
4
Notes/Hints
Partial Points
- If all test cases with $ N ≦ 20 $ are solved correctly, 45 points are awarded as partial credit
- If all test cases with $ N ≦ 200 $ are solved correctly, an additional 40 points are awarded as partial credit
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分