HorDuzi
Perica drew n horizontal line segments on a piece of paper. Then he gave that paper to his friend Jovica and asked him to count all the line segments. However, if there is an overlap between some line segments, Jovica will not notice that they are distinct segments, so he will count them as one segment only. Two line segments overlap if they have at least one common point. How many line segments will Jovica count?
InputThe first line of the standard input contains one integer n (1 <= n <= 100.000), the number of line segments.
In the each of the next n lines, there are three integers yi , xai , xbi (-1.000.000.000 <= yi , xai , xbi <= 1.000.000.000), which represents that i-th line segment has end points with coordinates ( xai , yi ) and ( xbi , yi ).
In the each of the next n lines, there are three integers yi , xai , xbi (-1.000.000.000 <= yi , xai , xbi <= 1.000.000.000), which represents that i-th line segment has end points with coordinates ( xai , yi ) and ( xbi , yi ).
OutputThe first and the only line of the standard output should contain the number of line segments Jovica can see.
Input:
7
7 5 8
3 8 4
4 1 2
3 5 2
3 3 10
7 2 5
7 12 9Output:
4Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.