Planar Graph
Time limit1sMemory limit2048 MB
For each segment of a plane graph, decide whether some source point can reach its midpoint by a curve that crosses no other segment.
- Level
Medium7 of 10
- Topics
- Geometry, Graph, Implementation
- Solved
- No attempts yet
Problem
There are base points on the plane, with some segments connecting them. Every two base points are distinct, no three base points are collinear, and segments only intersect at their endpoints. There are also source points on the plane. Each source point is different from all base points and does not lie on any segment. For each segment, determine whether you can draw a curve from some source point to the midpoint of that segment without intersecting any other segment.
Input
The first line contains three integers , , (; ). Each of the next lines contains two integers , (), the coordinates of a base point. Each of the next lines contains two integers , (), the coordinates of a source point. Each of the last lines contains two integers , (), meaning the segment connects the -th and -th base points.
Output
Print a string of length . The -th character is "1" if some source point has a curve to the midpoint of the -th segment that does not intersect any other segment, and "0" otherwise.