結果

問題 No.1331 Moving Penguin
ユーザー Kiri8128Kiri8128
提出日時 2021-01-08 22:10:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 892 ms / 1,500 ms
コード長 600 bytes
コンパイル時間 388 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 85,888 KB
最終ジャッジ日時 2024-04-25 04:45:51
合計ジャッジ時間 35,578 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
70,784 KB
testcase_01 AC 42 ms
58,752 KB
testcase_02 AC 49 ms
58,496 KB
testcase_03 AC 42 ms
59,264 KB
testcase_04 AC 716 ms
82,560 KB
testcase_05 AC 877 ms
84,736 KB
testcase_06 AC 892 ms
84,608 KB
testcase_07 AC 864 ms
84,608 KB
testcase_08 AC 750 ms
84,352 KB
testcase_09 AC 751 ms
84,224 KB
testcase_10 AC 745 ms
81,792 KB
testcase_11 AC 889 ms
84,224 KB
testcase_12 AC 877 ms
84,352 KB
testcase_13 AC 753 ms
84,480 KB
testcase_14 AC 756 ms
84,736 KB
testcase_15 AC 758 ms
84,352 KB
testcase_16 AC 773 ms
84,352 KB
testcase_17 AC 739 ms
84,480 KB
testcase_18 AC 739 ms
84,352 KB
testcase_19 AC 740 ms
84,480 KB
testcase_20 AC 744 ms
84,480 KB
testcase_21 AC 757 ms
84,352 KB
testcase_22 AC 748 ms
84,864 KB
testcase_23 AC 770 ms
84,480 KB
testcase_24 AC 763 ms
84,352 KB
testcase_25 AC 751 ms
84,352 KB
testcase_26 AC 758 ms
85,632 KB
testcase_27 AC 766 ms
85,760 KB
testcase_28 AC 798 ms
85,760 KB
testcase_29 AC 733 ms
81,408 KB
testcase_30 AC 308 ms
78,592 KB
testcase_31 AC 470 ms
81,152 KB
testcase_32 AC 276 ms
75,648 KB
testcase_33 AC 383 ms
79,872 KB
testcase_34 AC 526 ms
82,560 KB
testcase_35 AC 875 ms
85,248 KB
testcase_36 AC 875 ms
85,120 KB
testcase_37 AC 882 ms
84,992 KB
testcase_38 AC 316 ms
78,976 KB
testcase_39 AC 743 ms
85,888 KB
testcase_40 AC 420 ms
81,024 KB
testcase_41 AC 849 ms
82,816 KB
testcase_42 AC 773 ms
82,560 KB
testcase_43 AC 768 ms
82,688 KB
testcase_44 AC 772 ms
82,688 KB
testcase_45 AC 754 ms
82,944 KB
testcase_46 AC 775 ms
82,688 KB
testcase_47 AC 753 ms
82,688 KB
testcase_48 AC 736 ms
79,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

P = 10 ** 9 + 7
N = int(input())
A = [int(a) for a in input().split()]
X = [0] * N
X[0] = 1
K = 400
Y = [[0] * a for a in range(K)]

for i, a in enumerate(A):
    s = X[i] + X[i-1]
    if s >= P: s -= P
    for j in range(1, K):
        s += Y[j][i%j]
        if s >= P: s -= P
    X[i] = s
    if a < K:
        ia = i % a
        Y[a][ia] += s
        if Y[a][ia] >= P: Y[a][ia] -= P
        if a == 1 and i < N - 1:
            X[i+1] -= s
            if X[i+1] < 0: X[i+1] += P
    else:
        for j in range(i + a, N, a):
            X[j] += s
            if X[j] >= P: X[j] -= P
print(X[-1])
0