| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 87 | 20 | 18 | 27.692% |
Benson the Rabbit now has to build a plane!
Benson the Rabbit has a factory with $n$ machines numbered from $1$ to $n$. Each machine runs for one day and only one machine can run at a time. He has $m$ tasks to complete, numbered from $1$ to $m$. Each task $i$ is represented by two positive integers $l[i]$ and $r[i]$ where $l[i] ≤ r[i]$.
To complete task $i$, Benson needs to run machines $l[i], l[i] + 1, \dots , r[i]$ in that order. Once a machine has finished running, the next machine starts immediately. Once task $i$ is complete, Benson immediately starts task $i + 1$ until task $m$ is complete.
In order to comply with safety regulations, the factory must have an safety value $s$. If a machine with safety value $s$ was not run in the past $s$ or more days, this machine needs to be inspected before it can be run. Machines do not need to be inspected the first time they are run. See the samples for more details.
Benson has $q$ different candidate safety values $s[1], s[2], \dots , s[q]$. For each safety value $s[j]$, help him compute the number of inspections that need to be done if the safety value is $s[j]$.
The first line of input will contain $3$ spaced integers $n$, $m$ and $q$, representing the number of machines, tasks and safety values 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 task $i$.
The next line of input will contain $q$ spaced integers $s[1], s[2], \dots , s[q]$, which represent the $q$ safety values to be tested.
Output one line with $q$ spaced integers, the $j$-th integer representing the number of inspections that need to be done if the safety value is $s[j]$.
| 번호 | 배점 | 제한 |
|---|---|---|
| 1 | 11 | $1 ≤ n, m, q ≤ 200$ |
| 2 | 18 | $1 ≤ n, m ≤ 2000$ |
| 3 | 22 | $l[i] = 1$ |
| 4 | 26 | $m ≤ 2000$ |
| 5 | 23 | No additional restrictions |
5 3 7 1 3 3 5 2 3 0 1 2 3 4 5 6
3 2 2 2 1 0 0
The machines will be run in the following order: $1$, $2$, $3$, $3$, $4$, $5$, $2$, $3$.
On the $4$-th day, machine $3$ will be run $0$ days after it was last run.
On the $7$-th day, machine $2$ will be run $4$ days after it was last run.
On the $8$-th day, machine $3$ will be run $3$ days after it was last run.
If the safety value is $0$, then machine $3$ would need to be inspected on day $4$ and day $8$, while machine $2$ would need to be inspected on day $7$.
If the safety value is $2$, then machine $3$ would only need to be inspected on day $8$. Machine $2$ would still need to be inspected on day $7$.
6 6 7 1 6 1 5 1 4 1 3 1 2 1 1 1 2 3 4 5 6 7
15 14 12 9 5 0 0