| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1.5 초 | 1024 MB | 45 | 21 | 16 | 66.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,ドル
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 | 3 | 1ドル ≤ n, m, q ≤ 200$ |
| 2 | 6 | 1ドル ≤ n, m, q ≤ 2000$ |
| 3 | 15 | 1ドル ≤ n ≤ 2000$ |
| 4 | 20 | $s[j] = 1$ |
| 5 | 36 | 1ドル ≤ n, m, q ≤ 100,000円$ |
| 6 | 20 | No additional restrictions |
6 2 3 1 2 3 4 1 3 1 4 1 5
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.
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