PivotOJ

Paper Snowflakes

시간 제한: 5000ms메모리 제한: 1024MB출처: ICPC Rocky Mountain Regional 2020BOJ 21199

문제

To make a paper snowflake, you fold a sheet of paper in various places and then cut some parts out of the folded sheet. When you unfold the sheet, it can make a very nice pattern. That is, if the folds and cuts are chosen well.

Samantha has recently taken up this hobby but with a "modern art" twist. To get started, she explores folding a strip of paper that is LL picometres long (Samantha likes to measure her folds and cuts very precisely). She places it on the real line with one end at 00 and the other at LL. The left end at point 00 is affixed to this point, the other endpoint at position LL is the loose endpoint.

She then performs a series of folds. For the first fold, Samantha creases the paper f1f_1 picometres from the loose end and folds the loose end over this fold. The loose end is now pointing towards the left. For the second fold, she then creases the top portion of the paper f2f_2 picometres from the loose end (f2<f1f_2 < f_1) and folds the top portion of the paper over this point back to the right over this crease point. The loose end is now pointing towards the right.

She alternates folding back-and-forth this way. At each step, she creases the top portion of the paper fif_i picometres from the loose end (fi<fi1f_i < f_{i-1}) and folds the loose end over the crease.

She will now cut the paper at MM distinct locations, which will split the paper into M+1M+1 piles. Each of the piles will have zero or more layers of paper in it. The figure below depicts the folded paper from the first sample input, the cuts (solid lines), and the xx-locations of where the paper was folded (dashed lines).

What is the total length of paper in each of the M+1M+1 piles?

입력

The first line of input consists of three integers NN (1N1051 \leq N \leq 10^5), which is the number of folds, MM (1M1051 \leq M \leq 10^5), which is the number of cuts, and LL (2L10182 \leq L \leq 10^{18}), which is the length of the paper in picometres.

The second line describes the folds. This line contains NN integers f1,f2,,fNf_1, f_2, \ldots, f_N, indicating that the ithi^\textrm{th} fold occurred fif_i picometres from the loose end. These values satisfy 1fN<fN1<<f1<L1 \leq f_N < f_{N-1} < \cdots < f_1 < L.

The third line describes the cuts. This line contains MM integers c1,c2,,cMc_1, c_2, \ldots, c_M, indicating that the ithi^\textrm{th} cut is cic_i picometres from the affixed point. These values satisfy 1018c1<c2<<cM1018-10^{18} \leq c_1 < c_2 < \cdots < c_M \leq 10^{18}.

출력

Output the total length of paper in each of the M+1M+1 piles, in order from left to right.

예제

예제 1

입력
4 2 20
19 17 11 7
1 6
출력
5 13 2

예제 2

입력
1 1 10
9
0
출력
8 2

예제 3

입력
1 2 1000000000000000000
500000000000000000
0 500000000000000000
출력
0 1000000000000000000 0
코드를 제출하려면 로그인하세요.