# TopCoder

Caido
$\mathbb{W}\mathcal{aimai}\sim$

87.0% (20/23)

54.2% (52/96)

# Description

《孟子•滕文公下•第六章》提到：

$$c_i = \sum_{1 \leq j, k \leq N, \gcd(j, k) = i} a_jb_k$$

# Input Format

$N$
$a_1\; a_2 \;a_3\; \dots\; a_N$
$b_1\; b_2 \;b_3\; \dots\; b_N$

1
9
7

2
5 5
6 2

4
1 2 3 4
5 6 7 8

63

70 10

155 52 21 32

# Problem Source

by Seanliu

No. Testdata Range Constraints Score
1 0~10 $N \leq 1000$ 20
2 0~15 $N \leq 8000$ 30
3 0~25 $N \leq 100000$ 50

# Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 65536 262144 1 2 3
1 1000 65536 262144 1 2 3
2 1000 65536 262144 1 2 3
3 1000 65536 262144 1 2 3
4 1000 65536 262144 1 2 3
5 1000 65536 262144 1 2 3
6 1000 65536 262144 1 2 3
7 1000 65536 262144 1 2 3
8 1000 65536 262144 1 2 3
9 1000 65536 262144 1 2 3
10 1000 65536 262144 1 2 3
11 1000 65536 262144 2 3
12 1000 65536 262144 2 3
13 1000 65536 262144 2 3
14 1000 65536 262144 2 3
15 1000 65536 262144 2 3
16 1000 65536 262144 3
17 1000 65536 262144 3
18 1000 65536 262144 3
19 1000 65536 262144 3
20 1000 65536 262144 3
21 1000 65536 262144 3
22 1000 65536 262144 3
23 1000 65536 262144 3
24 1000 65536 262144 3
25 1000 65536 262144 3