結果

問題 No.1331 Moving Penguin
ユーザー convexineqconvexineq
提出日時 2021-01-08 23:24:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,156 ms / 1,500 ms
コード長 411 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 94,720 KB
最終ジャッジ日時 2024-04-25 04:58:36
合計ジャッジ時間 46,789 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
67,072 KB
testcase_01 AC 45 ms
59,136 KB
testcase_02 AC 46 ms
58,880 KB
testcase_03 AC 45 ms
58,752 KB
testcase_04 AC 1,057 ms
94,720 KB
testcase_05 AC 1,054 ms
90,496 KB
testcase_06 AC 1,047 ms
90,624 KB
testcase_07 AC 1,043 ms
90,624 KB
testcase_08 AC 1,056 ms
92,928 KB
testcase_09 AC 1,084 ms
92,672 KB
testcase_10 AC 1,051 ms
90,240 KB
testcase_11 AC 1,039 ms
89,984 KB
testcase_12 AC 1,070 ms
92,544 KB
testcase_13 AC 1,054 ms
89,856 KB
testcase_14 AC 1,035 ms
90,112 KB
testcase_15 AC 1,145 ms
90,112 KB
testcase_16 AC 1,049 ms
89,856 KB
testcase_17 AC 1,037 ms
92,544 KB
testcase_18 AC 1,044 ms
92,672 KB
testcase_19 AC 1,018 ms
92,672 KB
testcase_20 AC 1,052 ms
92,672 KB
testcase_21 AC 1,046 ms
92,800 KB
testcase_22 AC 1,053 ms
92,672 KB
testcase_23 AC 1,044 ms
90,112 KB
testcase_24 AC 1,025 ms
89,856 KB
testcase_25 AC 1,040 ms
90,112 KB
testcase_26 AC 1,056 ms
93,824 KB
testcase_27 AC 1,053 ms
94,080 KB
testcase_28 AC 1,055 ms
93,952 KB
testcase_29 AC 1,036 ms
94,296 KB
testcase_30 AC 399 ms
76,800 KB
testcase_31 AC 627 ms
85,248 KB
testcase_32 AC 364 ms
75,136 KB
testcase_33 AC 507 ms
79,488 KB
testcase_34 AC 733 ms
88,064 KB
testcase_35 AC 1,044 ms
90,368 KB
testcase_36 AC 1,058 ms
90,496 KB
testcase_37 AC 1,034 ms
90,496 KB
testcase_38 AC 411 ms
76,416 KB
testcase_39 AC 1,020 ms
93,440 KB
testcase_40 AC 562 ms
81,536 KB
testcase_41 AC 1,067 ms
93,312 KB
testcase_42 AC 1,064 ms
93,056 KB
testcase_43 AC 1,156 ms
90,624 KB
testcase_44 AC 1,130 ms
90,496 KB
testcase_45 AC 1,041 ms
90,368 KB
testcase_46 AC 1,040 ms
90,240 KB
testcase_47 AC 1,041 ms
90,240 KB
testcase_48 AC 1,042 ms
89,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
*a, = map(int,input().split())
M = 512
MOD = 10**9+7
laz = [[0]*i for i in range(M)]
dp = [0]*(n+1)
dp[0] = 1
for i in range(n):
    for j in range(1,M):
        dp[i] += laz[j][i%j]
    dp[i] %= MOD
    ai = a[i]
    if ai >= M:
        for k in range(i+ai,n+1,ai):
            dp[k] += dp[i]
    else:
        laz[ai][i%ai] += dp[i]
    if ai != 1:
        dp[i+1] += dp[i]
print(dp[n-1]%MOD)
0