#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 , and . For , compute the value of , that is, the sum of for all indices such that and .
输入格式
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} $$- ()
- All input values are integers.
输出格式
Output lines. On the -th line (), output the answer for the case where .
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