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

28496번 - Inspections 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB81191728.333%

문제

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ドル ≤ n, m, q ≤ 200,000円$
  • 1ドル ≤ l[i] ≤ r[i] ≤ n$
  • 0ドル ≤ s[j] ≤ 10^{12}$

서브태스크

번호배점제한
111

1ドル ≤ n, m, q ≤ 200$

218

1ドル ≤ n, m ≤ 2000$

322

$l[i] = 1$

426

$m ≤ 2000$

523

No additional restrictions

예제 입력 1

5 3 7
1 3
3 5
2 3
0 1 2 3 4 5 6

예제 출력 1

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ドル$.

예제 입력 2

6 6 7
1 6
1 5
1 4
1 3
1 2
1 1
1 2 3 4 5 6 7

예제 출력 2

15 14 12 9 5 0 0

힌트

출처

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

채점 및 기타 정보

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

출처

대학교 대회

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

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