# TopCoder

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

75.0% (6/8)

37.5% (12/32)

Sample Input 1:
3
2 1
3 1
5 1

Sample Input 2:
4
2 2
3 1
6 3
10 2

Sample Output 1:
138

Sample Output 2:
81320

# Hints

1. A = 3 + 5, B = 3
2. A = 3 + 5, B = 5
3. A = 2 + 3, B = 2
4. A = 2 + 3, B = 3
5. A = 2 + 5, B = 2
6. A = 2 + 5, B = 5

# Problem Source

CF 1436 F 改

No. Testdata Range Constraints Score
1 0~1 範例測資 0
2 2~12 $\sum b_i \leq 18$ 8
3 2~12, 43~55 $n \leq 18$ 11
4 2~12, 32~42 $\sum b_i \leq 1200$ 26
5 2~21, 32~55 $n \leq 1200$ 19
6 0~55 無其他限制 36

# Testdata and Limits

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