93.8% (15/16)

50.8% (62/122)

# Description

• $k=2 \lor k=3$
• $\forall 1 \leq i \leq j \leq k,\ \gcd(s_i, s_j) > 1$

#### 測資限制

• $2 \leq N \leq 500$
• $2 \leq A_i \leq 10^ 9$

# Sample Input

// Sample input 1
7
2 3 3 2 5 5 2

// Sample input 2
5
2 3 12 6 4

// Sample input 3
5
10 9 3 10 10

// Sample input 4
5
2 3 8 6 4

# Sample Output

// Sample output 1
12

// Sample output 2
11

// Sample output 3
23

// Sample output 4
-1

# Problem Source

2021 師大附中校隊培訓 模擬競賽
From NTU ADA 2021 Fall HW2

No. Testdata Range Constraints Score
1 0~3 範例測資 0
2 4~17 $N \le 10$ 9
3 18~23 $A_i$ 一定是質數，且若一種數字有出現，它會出現恰 $2$ 或 $3$ 次 11
4 4~17, 24~36 $N \le 100$ 31
5 0~47 無額外限制 49

# Testdata and Limits

No. Time Limit (ms) Memory Limit (KiB) Output Limit (KiB) Subtasks
0 1000 524288 65536 1 5
1 1000 524288 65536 1 5
2 1000 524288 65536 1 5
3 1000 524288 65536 1 5
4 1000 524288 65536 2 4 5
5 1000 524288 65536 2 4 5
6 1000 524288 65536 2 4 5
7 1000 524288 65536 2 4 5
8 1000 524288 65536 2 4 5
9 1000 524288 65536 2 4 5
10 1000 524288 65536 2 4 5
11 1000 524288 65536 2 4 5
12 1000 524288 65536 2 4 5
13 1000 524288 65536 2 4 5
14 1000 524288 65536 2 4 5
15 1000 524288 65536 2 4 5
16 1000 524288 65536 2 4 5
17 1000 524288 65536 2 4 5
18 1000 524288 65536 3 5
19 1000 524288 65536 3 5
20 1000 524288 65536 3 5
21 1000 524288 65536 3 5
22 1000 524288 65536 3 5
23 1000 524288 65536 3 5
24 1000 524288 65536 4 5
25 1000 524288 65536 4 5
26 1000 524288 65536 4 5
27 1000 524288 65536 4 5
28 1000 524288 65536 4 5
29 1000 524288 65536 4 5
30 1000 524288 65536 4 5
31 1000 524288 65536 4 5
32 1000 524288 65536 4 5
33 1000 524288 65536 4 5
34 1000 524288 65536 4 5
35 1000 524288 65536 4 5
36 1000 524288 65536 4 5
37 1000 524288 65536 5
38 1000 524288 65536 5
39 1000 524288 65536 5
40 1000 524288 65536 5
41 1000 524288 65536 5
42 1000 524288 65536 5
43 1000 524288 65536 5
44 1000 524288 65536 5
45 1000 524288 65536 5
46 1000 524288 65536 5
47 1000 524288 65536 5