| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1.5 초 | 1024 MB | 59 | 25 | 20 | 71.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$,
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