Electromagnetic Attacks

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

요약
삼각분할된 볼록 다각형 형태의 평면 그래프가 주어지고, 축에 나란한 직사각형 공격 영역마다 그 영역에 닿는 정점과 간선을 제거한 뒤 남은 그래프가 연결되어 있는지 판정한다.
난이도

어려움10점 중 9점

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

문제

In Barareh, a Point-to-Point (P2P) wireless network is used to connect base stations for private data services. In a P2P wireless network, each base station uses some directional antennas to connect with the other base stations. If base stations are modeled as points and communication links are modeled as line segments, the P2P network in Barareh surprisingly has some geometric properties. Specifically, the network is a planar graph whose outer boundary is a convex polygon and all interior faces are triangles.

In the recent world conflicts, an important question has occupied the mind of Khorzukhan, the Minister of Information and Communications Technology (ICT) of Barareh. He wants to know how resilient the network is to electromagnetic attacks. In an electromagnetic attack, noise is created in a certain region (so-called attack region), disrupting all communications passing through that region. The remaining network consists of every base station and every communication link that were strictly outside of the attack region. Specifically, Khorzukhan wants to know if the remaining network remains connected. To achieve this, he has instructed his ministry to simulate multiple electromagnetic attacks separately, testing the network’s tolerance to interference and reporting whether the remaining network stays connected after each simulation.

입력

The first line of input contains nn, mm, and kk (3≤n≤1053 \le n \le 10^5 , 3≤m≤3⋅1053 \le m \le 3 \cdot 10^5, 1≤k≤1051 \le k \le 10^5), which are the number of base stations, the number of communication links, and the number of attack simulations, respectively.

In the next nn lines, the iith line contains the xx and yy coordinates of the iith base station, both of which are non-negative integers (0≤x,y≤1090 \le x, y \le 10^9). It is guaranteed that not all base stations are collinear.

Each of the next mm lines represents a communication link. Each line contains two integers ii and jj (1≤i,j≤n1 \le i, j \le n), representing a communication link as a straight line segment between iith and jjth base station. The mm communication links form a planar graph. The outer boundary is a convex polygon and interior faces are all triangles.

At the end, the attack regions come in kk lines. Each attack region is a non-empty rectangle, represented by the coordinates x_1x\_1, y_1y\_1, x_2x\_2, y_2y\_2 of its lower-left and upper-right corners (0≤x_1<x_2≤1090 \le x\_1 < x\_2 \le 10^9, 0≤y_1<y_2≤1090 \le y\_1 < y\_2 \le 10^9). The sides of all rectangles are parallel to the coordinate axes. Note that if a base station or some part (even one point) of a link lies inside the attack region (including the boundary), it is not usable during the attack.

출력

In kk lines, for each attack simulation, print Yes if the remaining network resulting from the attack is connected; otherwise print No. If all base stations are within the attack region, the remaining network becomes empty and is still considered connected.

예제1

  1. 예제 1

    입력
    5 8 2
    1 1
    1 5
    5 4
    4 2
    3 4
    1 2
    2 3
    3 4
    4 1
    5 1
    5 2
    5 3
    5 4
    1 2 4 5
    2 3 3 4
    
    예상 출력
    No
    Yes