結果

問題 No.1331 Moving Penguin
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-01-08 22:23:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 783 ms / 1,500 ms
コード長 595 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 91,136 KB
最終ジャッジ日時 2024-04-25 04:49:54
合計ジャッジ時間 30,708 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
65,920 KB
testcase_01 AC 41 ms
51,968 KB
testcase_02 AC 39 ms
51,968 KB
testcase_03 AC 40 ms
52,224 KB
testcase_04 AC 699 ms
88,832 KB
testcase_05 AC 689 ms
87,040 KB
testcase_06 AC 692 ms
86,912 KB
testcase_07 AC 696 ms
86,784 KB
testcase_08 AC 692 ms
87,040 KB
testcase_09 AC 683 ms
87,040 KB
testcase_10 AC 693 ms
86,144 KB
testcase_11 AC 686 ms
86,144 KB
testcase_12 AC 692 ms
86,272 KB
testcase_13 AC 687 ms
86,400 KB
testcase_14 AC 688 ms
86,528 KB
testcase_15 AC 690 ms
86,272 KB
testcase_16 AC 703 ms
86,272 KB
testcase_17 AC 697 ms
87,424 KB
testcase_18 AC 713 ms
87,424 KB
testcase_19 AC 693 ms
87,296 KB
testcase_20 AC 684 ms
86,912 KB
testcase_21 AC 695 ms
86,784 KB
testcase_22 AC 687 ms
86,784 KB
testcase_23 AC 686 ms
86,272 KB
testcase_24 AC 692 ms
86,272 KB
testcase_25 AC 704 ms
86,272 KB
testcase_26 AC 710 ms
91,136 KB
testcase_27 AC 705 ms
91,136 KB
testcase_28 AC 710 ms
91,136 KB
testcase_29 AC 700 ms
88,320 KB
testcase_30 AC 188 ms
73,856 KB
testcase_31 AC 341 ms
81,792 KB
testcase_32 AC 167 ms
72,832 KB
testcase_33 AC 259 ms
77,184 KB
testcase_34 AC 453 ms
85,760 KB
testcase_35 AC 748 ms
90,624 KB
testcase_36 AC 752 ms
90,496 KB
testcase_37 AC 745 ms
90,624 KB
testcase_38 AC 200 ms
75,136 KB
testcase_39 AC 671 ms
91,008 KB
testcase_40 AC 297 ms
79,360 KB
testcase_41 AC 693 ms
87,552 KB
testcase_42 AC 752 ms
90,496 KB
testcase_43 AC 760 ms
90,496 KB
testcase_44 AC 745 ms
90,752 KB
testcase_45 AC 779 ms
90,496 KB
testcase_46 AC 783 ms
90,496 KB
testcase_47 AC 778 ms
90,624 KB
testcase_48 AC 687 ms
85,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
x = int(n**0.5)
count = [[0]*(i+1) for i in range(x)]
dp = [0]*(n+1)
dp[0] = 1
for i,a in enumerate(A):

    for j in range(x):
        dp[i] += count[j][(i+1)%(j+1)]
        dp[i] %= mod

    if a == 1:
        count[0][0] += dp[i]
        count[0][0] %= mod

        continue
    dp[i+1] += dp[i]
    dp[i+1] %= mod
    if a <= x:
        count[a-1][(i+1)%a] += dp[i]
        count[a-1][(i+1)%a] %= mod
    else:
        for j in range(i+a,n,a):
            dp[j] += dp[i]
            dp[j] %= mod

print(dp[-2])
        
    
0