QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 1024 MB مجموع النقاط: 100

#23338. 路燈

الإحصائيات

一條數線道路上有 $N$ 盞亮著的路燈。各路燈從左到右的位置記為 $A_1<\cdots<A_N$。

定義位置 $x$ 的黑暗程度為該位置到最近路燈的距離,即 $N$ 個數 $|A_1-x|,\ldots,|A_N-x|$ 中的最小值。其中 $|\cdot|$ 表示絕對值:當 $y\ge0$ 時,$|y|:=y$;當 $y<0$ 時,$|y|:=-y$。

例如,如果 $N=3$ 盞路燈分別位於 $A_1=1$、$A_2=4$、$A_3=8$,那麼從 $0$ 到 $10$ 各整數位置的黑暗程度如下。

位置 $0$ $1$ $2$ $3$ $4$ $5$ $6$ $7$ $8$ $9$ $10$
黑暗程度 $1$ $0$ $1$ $1$ $0$ $1$ $2$ $1$ $0$ $1$ $2$
是否有路燈? O O O

請編寫程式,計算從 $x=0$ 到 $x=L$ 的全部 $L+1$ 個整數位置的黑暗程度,並從最小值到第 $K$ 小的值依序輸出。

資料範圍

  • 給出的所有數均為整數。
  • $1\le L\le 1\,000\,000\,000\,000\,000\,000$
  • $1\le N\le300\,000$
  • $1\le K\le500\,000$
  • $K\le L+1$
  • $0\le A_1<A_2<\cdots<A_N\le L$

子任務

# 分數 條件
1 10 $N=1$
2 20 $N\le2\,500$, $L\le2\,500$
3 15 $2\le N$,$N-1$ 整除 $L$,$A_i=\frac{L}{N-1}\times(i-1)$。
4 20 $L\le5\,000\,000$
5 35 沒有額外限制。

輸入格式

第一行依序給出三個整數 $L,N,K$,以空格分隔。

下一行依序給出 $N$ 個整數 $A_1,\ldots,A_N$,以空格分隔。

輸出格式

從第一行開始,用 $K$ 行輸出答案,其中第 $i$ 行輸出第 $i$ 小的黑暗程度。

範例

輸入格式 1

10 3 4
1 4 8

輸出格式 1

0
0
0
1

輸入格式 2

4 5 5
0 1 2 3 4

輸出格式 2

0
0
0
0
0

輸入格式 3

7 1 4
3

輸出格式 3

0
1
1
2

輸入格式 4

9 4 10
0 3 6 9

輸出格式 4

0
0
0
0
1
1
1
1
1
1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.