#P15729. [JAG 2024 Summer Camp #2] Add Add Add

[JAG 2024 Summer Camp #2] Add Add Add

题目描述

You are given two sequences of positive integers of length NN, (A1,A2,,AN)(A_1, A_2, \ldots, A_N) and (B1,B2,,BN)(B_1, B_2, \ldots, B_N). For k=2,3,,2Nk = 2, 3, \ldots, 2N, compute the value of i+jk(Ai+Bj)\sum_{i+j \leq k} (A_i + B_j), that is, the sum of (Ai+Bj)(A_i + B_j) for all indices (i,j)(i, j) such that i+jki + j \leq k and 1i,jN1 \leq i, j \leq N.

输入格式

The input is given in the following format:

$$\begin{aligned} &N \\ &A_1 \ A_2 \ \ldots \ A_N \\ &B_1 \ B_2 \ \ldots \ B_N \end{aligned} $$
  • 1N200,0001 \leq N \leq 200,000
  • 1Ai,Bi1061 \leq A_i, B_i \leq 10^6 (1iN1 \leq i \leq N)
  • All input values are integers.

输出格式

Output 2N12N - 1 lines. On the ii-th line (1i2N11 \leq i \leq 2N - 1), output the answer for the case where k=i+1k = i + 1.

3
1 1 1
1 1 1
2
6
12
16
18
5
3 7 1 8 3
7 10 5 3 4
10
37
70
114
165
206
230
248
255
1
3
5
8