Server Time：

31.4% (22/70)

10.8% (22/203)

# Description

1. 首先選擇一個格子 $i$ 作為起點 (該格的數字為 $a_i$)，放上一個硬幣
2. 當 $i \le n$，可得到分數 $a_i$，並且將硬幣往右移動 $a_i$ 格 (就是移到位置 $i + a_i$)
3. 重複第 2 步的動作直到 $i > n$

• 偉杰先選 $i = 1$，則過程為 $i = 1 \overset{+5}{\longrightarrow} 6$，得分為 $a_1 = 5$
• 偉杰先選 $i = 2$，則過程為 $i = 2 \overset{+1}{\longrightarrow} 3 \overset{+2}{\longrightarrow} 5$，得分為 $a_2 + a_3 = 3$
• 偉杰先選 $i = 3$，則過程為 $i = 3 \overset{+2}{\longrightarrow} 5$，得分為 $a_3 = 2$
• 偉杰先選 $i = 4$，則過程為 $i = 4 \overset{+4}{\longrightarrow} 8$，得分為 $a_4 = 4$

6
2 1000 2 3 995 1

1000

5
7 3 1 2 3

7

4
1 1 1 1

4

# Problem Source

Codeforces 1472C Long Jumps

No. Testdata Range Constraints Score
1 0~9 $n \le 100, a_i \le {n\over 5}$ 20
2 10~19 $n \le 100$ 20
3 0~45 $n \le 10^6$ 60

# Testdata and Limits

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