Curtains | 프로그래밍의 벗 PivotOJ
PivotOJ

Curtains

시간 제한: 1500ms메모리 제한: 1024MB출처: NOI 2023BOJ 28498

문제

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 ≤ n) is covered if and only if there exists a lowered curtain ii such that 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 ≤ n,

  • If 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

입력
6 2 3
1 2
3 4
1 3
1 4
1 5
출력
NO
YES
NO

예제 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
코드를 제출하려면 로그인하세요.