結果

問題 No.1331 Moving Penguin
ユーザー convexineqconvexineq
提出日時 2021-01-08 23:37:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 509 ms / 1,500 ms
コード長 411 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 82,816 KB
実行使用メモリ 93,696 KB
最終ジャッジ日時 2024-04-25 04:57:10
合計ジャッジ時間 21,382 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
65,920 KB
testcase_01 AC 42 ms
51,968 KB
testcase_02 AC 42 ms
52,096 KB
testcase_03 AC 45 ms
57,984 KB
testcase_04 AC 451 ms
93,696 KB
testcase_05 AC 446 ms
89,584 KB
testcase_06 AC 447 ms
89,600 KB
testcase_07 AC 446 ms
89,216 KB
testcase_08 AC 436 ms
89,216 KB
testcase_09 AC 454 ms
89,472 KB
testcase_10 AC 442 ms
88,960 KB
testcase_11 AC 454 ms
89,176 KB
testcase_12 AC 452 ms
88,960 KB
testcase_13 AC 448 ms
89,088 KB
testcase_14 AC 451 ms
89,088 KB
testcase_15 AC 442 ms
88,960 KB
testcase_16 AC 451 ms
89,088 KB
testcase_17 AC 434 ms
90,240 KB
testcase_18 AC 445 ms
90,240 KB
testcase_19 AC 444 ms
89,984 KB
testcase_20 AC 460 ms
89,856 KB
testcase_21 AC 462 ms
89,856 KB
testcase_22 AC 463 ms
89,728 KB
testcase_23 AC 442 ms
88,704 KB
testcase_24 AC 437 ms
88,832 KB
testcase_25 AC 446 ms
88,960 KB
testcase_26 AC 468 ms
93,056 KB
testcase_27 AC 472 ms
93,016 KB
testcase_28 AC 457 ms
92,800 KB
testcase_29 AC 453 ms
91,392 KB
testcase_30 AC 191 ms
74,880 KB
testcase_31 AC 284 ms
82,560 KB
testcase_32 AC 180 ms
73,600 KB
testcase_33 AC 245 ms
78,720 KB
testcase_34 AC 334 ms
87,040 KB
testcase_35 AC 509 ms
92,800 KB
testcase_36 AC 498 ms
92,416 KB
testcase_37 AC 503 ms
92,504 KB
testcase_38 AC 203 ms
75,904 KB
testcase_39 AC 450 ms
92,800 KB
testcase_40 AC 264 ms
81,136 KB
testcase_41 AC 496 ms
92,416 KB
testcase_42 AC 504 ms
92,416 KB
testcase_43 AC 504 ms
92,288 KB
testcase_44 AC 505 ms
92,448 KB
testcase_45 AC 507 ms
92,672 KB
testcase_46 AC 506 ms
92,288 KB
testcase_47 AC 505 ms
92,416 KB
testcase_48 AC 439 ms
88,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
*a, = map(int,input().split())
M = 200
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