Cutting Arcs

4

1 votes
Easy-Medium
Problem

Ashu loves geometry lot. He and some of his friends draw some arcs on a paper. The center of arc is (0,0) . All arcs are of distinct radius and for every arc they have written what is the starting angle si and what is the ending angle ei . Now he wonders that if he is given an option to draw a ray originating from (0,0) then how many maximum number of arcs he can cut.
Remember that angles are not necessary to be integral.
Note that there can exist arcs like 300.0 to 60.0 where start angle is larger but the end angle is smaller. You can have a look at the diagram below
enter image description here
Input
First line contains t as input (testcases) . These t test cases containn as input where n is the total number of arcs drawn . Next n lines contains two real numbers each, denoting the start angle and ending angle in anti-clockwise order.

Output
For every test case you have to output maximum number of arcs that can be cut if a person draws a ray from point (0,0). You can assume the length of ray to be more than maximum radius of any arc that is drawn.

Constraints
1t10
1n105
0.0si,ei360.0

Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

You can draw a ray at 90 angle and that results in 2 arcs

Editor Image

?