시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 11 | 2 | 2 | 50.000% |
The 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 \le n \le 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\cdot x^2 + q_1 \cdot xy + q_2 \cdot y^2 + q_3 \cdot x + q_4 \cdot 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 \cdot x + b_i \cdot 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 \ne 0$ or $b_i \ne 0$.
Print one integer --- the number of lands.
1 1 0 1 0 0 -1 1 -1 0
4
2 1 0 0 0 -1 0 2 -1 -1 6 9 1
7
2 1 0 -1 0 0 -1 3 0 6 -5 0 -10
6
Camp > Bytedance-Moscow Workshops Camp > Bytedance-Moscow Workshops Camp 2020 > Contest 1 L번