아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Curtains

시간 제한1.5초메모리 제한1024 MB

요약
구간들이 주어지고 각 질의에 대해 주어진 구간만 정확히 덮는 부분집합이 존재하는지 판정한다.
난이도

보통10점 중 6점

유형
구간, 그리디, 누적 합
정답자
아직 제출이 없습니다

문제

Benson the Rabbit is organizing a performance on his plane!

He has a stage with nn sections numbered 11 to nn from left to right. He also has mm curtains numbered from 11 to mm.

Each of these mm curtains can be lowered. Lowering curtain ii covers sections l\[i]l\[i] to r\[i]r\[i]. A curtain configuration is a set of lowered curtains. Given a curtain configuration, a section xx (1≤x≤n1 ≤ x ≤ n) is covered if and only if there exists a lowered curtain ii such that l\[i]≤x≤r\[i]l\[i] ≤ x ≤ r\[i].

Benson wants to give a total of qq performances, numbered from 11 to qq. For each performance jj, Benson requires a curtain configuration such that the sections s\[j]s\[j] to e\[j]e\[j] are covered and nothing else is covered. More formally, for each 1≤x≤n1 ≤ x ≤ n,

  • If s\[j]≤x≤e\[j]s\[j] ≤ x ≤ e\[j], section xx is covered.
  • Otherwise, section xx is not covered.

For each of these qq performances, help Benson to determine if there exists a curtain configuration satisfying his requirements.

입력

The first line of input will contain 33 spaced integers nn, mm and qq, representing the number of sections, curtains and performances respectively.

The next mm lines of input will contain 22 spaced integers each. The ii-th of these lines will contain l\[i]l\[i] and r\[i]r\[i] respectively, describing the range of sections that curtain ii can cover.

The next qq lines of input will contain 22 spaced integers each. The jj-th of these lines will contain s\[j]s\[j] and e\[j]e\[j] respectively, describing the range of sections that need to be covered for performance jj.

출력

Output qq lines, the jj-th of which should contain YES if it is possible to cover the required sections for the jj-th performance using the curtains, and NO otherwise.

제한

  • 1≤n,m,q≤500,0001 ≤ n, m, q ≤ 500\\,000
  • 1≤l\[i]≤r\[i]≤n1 ≤ l\[i] ≤ r\[i] ≤ n (for all 1≤i≤m1 ≤ i ≤ m)
  • 1≤s\[j]≤e\[j]≤n1 ≤ s\[j] ≤ e\[j] ≤ n (for all 1≤j≤q1 ≤ j ≤ q)

예제2

  1. 예제 1

    입력
    6 2 3
    1 2
    3 4
    1 3
    1 4
    1 5
    
    예상 출력
    NO
    YES
    NO
    
  2. 예제 2

    입력
    10 10 10
    6 9
    6 7
    1 6
    10 10
    5 9
    3 9
    2 10
    5 7
    9 10
    5 10
    7 8
    4 7
    1 6
    2 7
    3 9
    7 7
    2 9
    4 9
    6 6
    5 7
    
    예상 출력
    NO
    NO
    YES
    NO
    YES
    NO
    NO
    NO
    NO
    YES