Planar Graph

시간 제한1초메모리 제한2048 MB

요약
각 선분마다 어떤 source point에서 다른 선분을 지나지 않고 선분의 중점까지 곡선으로 도달할 수 있는지 판정한다.
난이도

보통10점 중 7점

유형
기하, 그래프, DFS
정답자
아직 제출이 없습니다

문제

There are nn base points on the plane, with some segments connecting them.

It is guaranteed that every two base points do not coincide, every three base points are not collinear, and segments only intersect at endpoints.

There are also mm source points on the plane.

It is guaranteed that every source point is different from each of the nn base points and does not lie on any segment.

The question is, for each segment, whether you can draw a curve from some source point to the midpoint of this segment without intersecting any other segments.

입력

The first line contains three integers nn, mm, ee (1≤n,m≤1001 \le n, m \le 100; 0≤e≤3000 \le e \le 300), denoting the number of base points, source points, and segments.

Each line of the next nn lines contains two integers xx, yy (∣x∣,∣y∣≤109|x|, |y| \le 10^9), denoting a base point (x,y)(x, y).

Each line of the next mm lines contains two integers xx, yy (∣x∣,∣y∣≤109|x|, |y| \le 10^9), denoting a source point (x,y)(x, y).

Each line of the next ee lines contains two integers ii, jj, denoting a segment connecting the ii-th base point and the jj-th base point (1≤i<j≤n1 \le i < j \le n).

출력

Print a string of length ee. The ii-th character of the string must be "1" if you can draw a curve from some source point to the midpoint of the ii-th segment without intersecting any other segments, or "0" otherwise.

예제1

  1. 예제 1

    입력
    4 1 3
    -2 0
    0 2
    2 0
    0 1
    0 3
    1 2
    2 3
    1 3
    
    예상 출력
    111