結果

問題 No.1331 Moving Penguin
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-09-03 13:00:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 886 ms / 1,500 ms
コード長 452 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 92,672 KB
最終ジャッジ日時 2024-04-28 11:37:28
合計ジャッジ時間 36,100 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
67,712 KB
testcase_01 AC 42 ms
59,648 KB
testcase_02 AC 41 ms
59,648 KB
testcase_03 AC 40 ms
59,392 KB
testcase_04 AC 787 ms
92,672 KB
testcase_05 AC 797 ms
88,448 KB
testcase_06 AC 787 ms
88,704 KB
testcase_07 AC 808 ms
88,832 KB
testcase_08 AC 781 ms
87,936 KB
testcase_09 AC 803 ms
88,320 KB
testcase_10 AC 779 ms
87,936 KB
testcase_11 AC 799 ms
88,064 KB
testcase_12 AC 794 ms
88,064 KB
testcase_13 AC 817 ms
88,064 KB
testcase_14 AC 781 ms
88,320 KB
testcase_15 AC 799 ms
88,320 KB
testcase_16 AC 835 ms
88,064 KB
testcase_17 AC 779 ms
87,040 KB
testcase_18 AC 789 ms
86,784 KB
testcase_19 AC 787 ms
87,040 KB
testcase_20 AC 785 ms
87,040 KB
testcase_21 AC 784 ms
86,912 KB
testcase_22 AC 771 ms
87,040 KB
testcase_23 AC 809 ms
88,064 KB
testcase_24 AC 789 ms
88,064 KB
testcase_25 AC 792 ms
88,064 KB
testcase_26 AC 797 ms
92,672 KB
testcase_27 AC 798 ms
92,544 KB
testcase_28 AC 807 ms
92,672 KB
testcase_29 AC 789 ms
89,856 KB
testcase_30 AC 309 ms
76,032 KB
testcase_31 AC 491 ms
84,992 KB
testcase_32 AC 269 ms
74,752 KB
testcase_33 AC 380 ms
78,976 KB
testcase_34 AC 562 ms
87,168 KB
testcase_35 AC 815 ms
92,032 KB
testcase_36 AC 805 ms
92,032 KB
testcase_37 AC 830 ms
92,032 KB
testcase_38 AC 322 ms
76,160 KB
testcase_39 AC 769 ms
92,416 KB
testcase_40 AC 438 ms
83,840 KB
testcase_41 AC 886 ms
88,192 KB
testcase_42 AC 771 ms
88,064 KB
testcase_43 AC 800 ms
88,192 KB
testcase_44 AC 795 ms
88,064 KB
testcase_45 AC 786 ms
88,064 KB
testcase_46 AC 785 ms
88,320 KB
testcase_47 AC 798 ms
88,064 KB
testcase_48 AC 793 ms
86,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


mod=10**9+7
n=int(input())
a=[0]+list(map(int,input().split()))
dp=[0]*(n+3)
dp[1]=1
B=400
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