Enclose Points

시간 제한5초메모리 제한512 MB

요약
서로 교차하지 않는 선분 M개로 연결된 점 N개가 주어질 때, 각 질의 점을 둘러싸는 선분 사이클이 존재하는지 판정한다.
난이도

보통10점 중 7점

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

문제

There are NN points and MM segments on the xyxy-plane. Each segment connects two of these points and they don't intersect each other except at the endpoints. You are also given QQ points as queries. Your task is to determine for each query point whether you can make a polygon that encloses the query point using some of the given segments. Note that the polygon should not necessarily be convex.

입력

Each input is formatted as follows.

$N$ $M$ $Q$

$x_1$ $y_1$

...

$x_N$ $y_N$

$a_1$ $b_1$

...

$a_M$ $b_M$

$qx_1$ $qy_1$

...

$qx_Q$ $qy_Q$

The first line contains three integers NN (2≤N≤100,0002 \leq N \leq 100{,}000), MM (1≤M≤100,0001 \leq M \leq 100{,}000), and QQ (1≤Q≤100,0001 \leq Q \leq 100{,}000), which represent the number of points, the number of segments, and the number of queries, respectively. Each of the following NN lines contains two integers x_ix\_i and y_iy\_i (−100,000≤x_i,y_i≤100,000-100{,}000 \leq x\_i, y\_i \leq 100{,}000), the coordinates of the ii-th point. The points are guaranteed to be distinct, that is, (x_i,y_i)≠(x_j,y_j)(x\_i, y\_i) \neq (x\_j, y\_j) when i≠ji \neq j. Each of the following MM lines contains two integers a_ia\_i and b_ib\_i (1≤a_i<b_i≤N1 \leq a\_i \lt b\_i \leq N), which indicate that the ii-th segment connects the a_ia\_i-th point and the b_ib\_i-th point. Assume that those segments do not intersect each other except at the endpoints. Each of the following QQ lines contains two integers qx_iqx\_i and qy_iqy\_i (−100,000≤qx_i,qy_i≤100,000-100{,}000 \leq qx\_i, qy\_i \leq 100{,}000), the coordinates of the ii-th query point.

You can assume that, for any pair of query point and segment, the distance between them is at least 10−410^{-4}.

출력

The output should contain QQ lines. Print "Yes" on the ii-th line if there is a polygon that contains the ii-th query point. Otherwise print "No" on the ii-th line.

예제3

  1. 예제 1

    입력
    4 5 3
    -10 -10
    10 -10
    10 10
    -10 10
    1 2
    1 3
    1 4
    2 3
    3 4
    -20 0
    1 0
    20 0
    
    예상 출력
    No
    Yes
    No
    
  2. 예제 2

    입력
    8 8 5
    -20 -20
    20 -20
    20 20
    -20 20
    -10 -10
    10 -10
    10 10
    -10 10
    1 2
    1 4
    2 3
    3 4
    5 6
    5 8
    6 7
    7 8
    -25 0
    -15 0
    0 0
    15 0
    25 0
    
    예상 출력
    No
    Yes
    Yes
    Yes
    No
    
  3. 예제 3

    입력
    8 8 5
    -20 -10
    -10 -10
    -10 10
    -20 10
    10 -10
    20 -10
    20 10
    10 10
    1 2
    2 3
    3 4
    1 4
    5 6
    6 7
    7 8
    5 8
    -30 0
    -15 0
    0 0
    15 0
    30 0
    
    예상 출력
    No
    Yes
    No
    Yes
    No