結果

問題 No.1331 Moving Penguin
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-09-03 13:01:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 710 ms / 1,500 ms
コード長 462 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 92,544 KB
最終ジャッジ日時 2024-04-28 11:38:10
合計ジャッジ時間 28,424 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
66,432 KB
testcase_01 AC 37 ms
52,096 KB
testcase_02 AC 37 ms
52,480 KB
testcase_03 AC 36 ms
52,096 KB
testcase_04 AC 643 ms
89,984 KB
testcase_05 AC 639 ms
88,704 KB
testcase_06 AC 636 ms
88,192 KB
testcase_07 AC 653 ms
88,576 KB
testcase_08 AC 634 ms
88,064 KB
testcase_09 AC 641 ms
87,680 KB
testcase_10 AC 658 ms
87,936 KB
testcase_11 AC 646 ms
87,808 KB
testcase_12 AC 636 ms
87,680 KB
testcase_13 AC 649 ms
87,424 KB
testcase_14 AC 638 ms
87,808 KB
testcase_15 AC 627 ms
87,680 KB
testcase_16 AC 632 ms
87,680 KB
testcase_17 AC 630 ms
86,784 KB
testcase_18 AC 642 ms
86,400 KB
testcase_19 AC 626 ms
86,528 KB
testcase_20 AC 632 ms
86,784 KB
testcase_21 AC 629 ms
87,040 KB
testcase_22 AC 635 ms
86,656 KB
testcase_23 AC 624 ms
88,064 KB
testcase_24 AC 632 ms
87,808 KB
testcase_25 AC 636 ms
87,680 KB
testcase_26 AC 649 ms
92,416 KB
testcase_27 AC 661 ms
92,032 KB
testcase_28 AC 670 ms
92,544 KB
testcase_29 AC 640 ms
89,600 KB
testcase_30 AC 173 ms
74,368 KB
testcase_31 AC 318 ms
82,432 KB
testcase_32 AC 157 ms
73,088 KB
testcase_33 AC 239 ms
77,312 KB
testcase_34 AC 392 ms
86,528 KB
testcase_35 AC 676 ms
91,776 KB
testcase_36 AC 678 ms
91,904 KB
testcase_37 AC 676 ms
91,904 KB
testcase_38 AC 185 ms
75,264 KB
testcase_39 AC 638 ms
92,032 KB
testcase_40 AC 275 ms
80,128 KB
testcase_41 AC 647 ms
87,552 KB
testcase_42 AC 690 ms
91,776 KB
testcase_43 AC 671 ms
91,648 KB
testcase_44 AC 675 ms
91,904 KB
testcase_45 AC 686 ms
91,904 KB
testcase_46 AC 710 ms
91,776 KB
testcase_47 AC 676 ms
91,904 KB
testcase_48 AC 624 ms
86,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


mod=10**9+7
n=int(input())
a=[0]+list(map(int,input().split()))
dp=[0]*(n+3)
dp[1]=1
B=int(n**0.5)+3
sdp=[[0]*(B+3) for i in range(B+3)]
for i in range(1,n+1):
    dp[i]+=dp[i-1]
    for j in range(1,B+1):
        dp[i]+=sdp[j][i%j]
    dp[i]%=mod
    if a[i-1]==1:dp[i]-=dp[i-1]
    dp[i]%=mod
    if a[i]<=B:
        sdp[a[i]][i%a[i]]+=dp[i]
        sdp[a[i]][i%a[i]]%=mod
    else:
        for j in range(i+a[i],n+1,a[i]):dp[j]+=dp[i]
print(dp[n]%mod)





0