#P15838. [蓝桥杯第一届国际赛] 平面染色
[蓝桥杯第一届国际赛] 平面染色
Problem Description
Xiao C has a very large sheet of white paper (assume it is infinite). In his spare time, Xiao C likes to draw various patterns on the paper using straight lines. These lines divide the white paper into several regions. Xiao C wants to fill each region with one of two colors: black and white. If two regions share a common edge, then they are adjacent. If two adjacent regions are filled with the same color, the coloring will look very unattractive. Also, Xiao C wants to keep the center of the paper in its original white color, i.e., the region containing the origin is white.
Now Xiao C has already drawn these lines, but there are too many regions after splitting, and he cannot find a good-looking coloring plan. Xiao C hopes that you, being clever, can tell him a coloring plan. Xiao C will ask you for the colors of points on the paper to help him understand the coloring.
If the coloring plan is not unique, you only need to give one.
Input Format
The first line contains two positive integers , representing the number of lines and the number of queried points.
The next lines each contain integers , describing a line passing through the points and .
The next lines each contain integers , representing the color query for the point .
Output Format
If no good-looking coloring plan exists, output .
If a good-looking coloring plan exists, output lines, each containing one number ( or ), representing the color of the queried point in your coloring plan ( means black, means white).
3 3
-1 -1 1 2
1 2 2 0
2 0 -1 -1
0 0
2 -1
1 3
1
0
1
Hint
Constraints and Notes on Test Cases
For of the test cases, , and each line is guaranteed to be parallel to the coordinate axes.
For of the test cases, , and each line is guaranteed to be parallel to the coordinate axes.
For the remaining of the test cases, .
For all test cases, , and .
For all test cases, it is guaranteed that the point is different from the point , all given lines are pairwise distinct, is not on any given line, and the origin is not on any given line.
Translated by ChatGPT 5