n개의 직선과 하나의 비퇴화 이차곡선이 평면을 나누는 영역의 수를 구한다. 직선이 겹칠 수도 있다.
어려움8기하조합론아직 제출이 없습니다시간 제한1초메모리 제한512 MBThe country of Infinistan can be represented as an infinite plane. In the country there are n straight walls and a river which has the form of a quadratic curve (an ellipse, a parabola or a hyperbola). The walls and the river divide the country into some lands of non-zero area. Your task is, given all the equations, to count the number of those lands.
The first line contains a single integer n --- the number of straight walls (1≤n≤20).
The second line contains six integers q_0, q_1, q_2, q_3, q_4 and q_5 --- coefficients of the river that is a quadratic curve q_0⋅x2+q_1⋅xy+q_2⋅y2+q_3⋅x+q_4⋅y+q_5=0.
Each of the following n lines contains three integers a_i, b_i and c_i --- coefficients of the straight line a_i⋅x+b_i⋅y+c_i=0.
All q_i, a_i, b_i and c_i do not exceed 100 by absolute value. The straight lines may coincide. You may assume that the quadratic curve is not degenerate, and that for any i either a_i=0 or b_i=0.
Print one integer --- the number of lands.