Logo
(追記) (追記ここまで)

28498번 - Curtains 서브태스크다국어

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

문제

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

힌트

출처

Olympiad > National Olympiad in Informatics (Singapore) > NOI 2023 4번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /