TopCoder

拉菲好可愛 >////<
迷子でもいい、迷子でも進め!

User's AC Ratio

75.0% (3/4)

Submission's AC Ratio

47.1% (8/17)

Tags

Description

Input Format

Output Format

Sample Input 1

4
2 4 6 3

Sample Output 1

24
21
22
17

Sample Input 2

10
36 32 27 16 64 30 20 35 42 24

Sample Output 2

4587
4563
3979
5058
4002
4774
5032
4153
4521
4599

Sample Input 3

6
249561088 536870912 719323136 998244352 285212672 606076928

Sample Output 3

6793
5045
5138
6725
8083
7588

Hints

Problem Source

YTP 2023 高中組程式挑戰營 p15

Subtasks

No. Testdata Range Constraints Score
1 0~2 範例測資 0
2 0~20 $n \leq 300$ 3
3 0~32 $n \leq 2000$ 7
4 0~44 $n \leq 16000$ 13
5 0~72 無額外限制 2

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 3000 1048576 65536 1 2 3 4 5
1 3000 1048576 65536 1 2 3 4 5
2 3000 1048576 65536 1 2 3 4 5
3 3000 1048576 65536 2 3 4 5
4 3000 1048576 65536 2 3 4 5
5 3000 1048576 65536 2 3 4 5
6 3000 1048576 65536 2 3 4 5
7 3000 1048576 65536 2 3 4 5
8 3000 1048576 65536 2 3 4 5
9 3000 1048576 65536 2 3 4 5
10 3000 1048576 65536 2 3 4 5
11 3000 1048576 65536 2 3 4 5
12 3000 1048576 65536 2 3 4 5
13 3000 1048576 65536 2 3 4 5
14 3000 1048576 65536 2 3 4 5
15 3000 1048576 65536 2 3 4 5
16 3000 1048576 65536 2 3 4 5
17 3000 1048576 65536 2 3 4 5
18 3000 1048576 65536 2 3 4 5
19 3000 1048576 65536 2 3 4 5
20 3000 1048576 65536 2 3 4 5
21 3000 1048576 65536 3 4 5
22 3000 1048576 65536 3 4 5
23 3000 1048576 65536 3 4 5
24 3000 1048576 65536 3 4 5
25 3000 1048576 65536 3 4 5
26 3000 1048576 65536 3 4 5
27 3000 1048576 65536 3 4 5
28 3000 1048576 65536 3 4 5
29 3000 1048576 65536 3 4 5
30 3000 1048576 65536 3 4 5
31 3000 1048576 65536 3 4 5
32 3000 1048576 65536 3 4 5
33 3000 1048576 65536 4 5
34 3000 1048576 65536 4 5
35 3000 1048576 65536 4 5
36 3000 1048576 65536 4 5
37 3000 1048576 65536 4 5
38 3000 1048576 65536 4 5
39 3000 1048576 65536 4 5
40 3000 1048576 65536 4 5
41 3000 1048576 65536 4 5
42 3000 1048576 65536 4 5
43 3000 1048576 65536 4 5
44 3000 1048576 65536 4 5
45 3000 1048576 65536 5
46 3000 1048576 65536 5
47 3000 1048576 65536 5
48 3000 1048576 65536 5
49 3000 1048576 65536 5
50 3000 1048576 65536 5
51 3000 1048576 65536 5
52 3000 1048576 65536 5
53 3000 1048576 65536 5
54 3000 1048576 65536 5
55 3000 1048576 65536 5
56 3000 1048576 65536 5
57 3000 1048576 65536 5
58 3000 1048576 65536 5
59 3000 1048576 65536 5
60 3000 1048576 65536 5
61 3000 1048576 65536 5
62 3000 1048576 65536 5
63 3000 1048576 65536 5
64 3000 1048576 65536 5
65 3000 1048576 65536 5
66 3000 1048576 65536 5
67 3000 1048576 65536 5
68 3000 1048576 65536 5
69 3000 1048576 65536 5
70 3000 1048576 65536 5
71 3000 1048576 65536 5
72 3000 1048576 65536 5