시간 제한메모리 제한제출정답맞힌 사람정답 비율
1.5 초 1024 MB59252071.429%

문제

Benson the Rabbit is organizing a performance on his plane!

He has a stage with $n$ sections numbered $1$ to $n$ from left to right. He also has $m$ curtains numbered from $1$ to $m$.

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

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

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

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

입력

The first line of input will contain $3$ spaced integers $n$, $m$ and $q$, representing the number of sections, curtains and performances respectively.

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

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

출력

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

제한

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

서브태스크

번호배점제한
13

$1 ≤ n, m, q ≤ 200$

26

$1 ≤ n, m, q ≤ 2000$

315

$1 ≤ n ≤ 2000$

420

$s[j] = 1$

536

$1 ≤ n, m, q ≤ 100\,000$

620

No additional restrictions

예제 입력 1

6 2 3
1 2
3 4
1 3
1 4
1 5

예제 출력 1

NO
YES
NO

Benson has $6$ sections and $2$ curtains. Curtain $1$ covers sections $1$ and $2$ while curtain $2$ covers sections $3$ and $4$.

It is not possible to exactly cover sections $1$ to $3$. It is also not possible to exactly cover sections $1$ to $5$. However, he can use both curtains to cover sections $1$ to $4$ exactly.

예제 입력 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

예제 출력 2

NO
NO
YES
NO
YES
NO
NO
NO
NO
YES

채점 및 기타 정보

  • 예제는 채점하지 않는다.