結果

問題 No.1331 Moving Penguin
ユーザー Kiri8128Kiri8128
提出日時 2021-01-08 22:09:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 811 ms / 1,500 ms
コード長 600 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 85,504 KB
最終ジャッジ日時 2024-04-25 04:45:11
合計ジャッジ時間 29,987 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
70,784 KB
testcase_01 AC 43 ms
52,736 KB
testcase_02 AC 47 ms
58,240 KB
testcase_03 AC 47 ms
58,368 KB
testcase_04 AC 624 ms
82,560 KB
testcase_05 AC 775 ms
84,696 KB
testcase_06 AC 771 ms
84,480 KB
testcase_07 AC 756 ms
84,096 KB
testcase_08 AC 617 ms
82,304 KB
testcase_09 AC 611 ms
82,304 KB
testcase_10 AC 607 ms
82,304 KB
testcase_11 AC 615 ms
81,900 KB
testcase_12 AC 614 ms
81,664 KB
testcase_13 AC 617 ms
82,176 KB
testcase_14 AC 626 ms
82,304 KB
testcase_15 AC 631 ms
82,284 KB
testcase_16 AC 626 ms
82,304 KB
testcase_17 AC 618 ms
84,224 KB
testcase_18 AC 610 ms
84,352 KB
testcase_19 AC 607 ms
84,480 KB
testcase_20 AC 621 ms
84,224 KB
testcase_21 AC 606 ms
84,096 KB
testcase_22 AC 614 ms
84,224 KB
testcase_23 AC 644 ms
82,176 KB
testcase_24 AC 620 ms
81,956 KB
testcase_25 AC 614 ms
81,280 KB
testcase_26 AC 637 ms
85,376 KB
testcase_27 AC 643 ms
85,376 KB
testcase_28 AC 634 ms
85,376 KB
testcase_29 AC 586 ms
81,408 KB
testcase_30 AC 283 ms
78,592 KB
testcase_31 AC 396 ms
80,640 KB
testcase_32 AC 242 ms
75,648 KB
testcase_33 AC 328 ms
79,744 KB
testcase_34 AC 458 ms
81,920 KB
testcase_35 AC 789 ms
84,736 KB
testcase_36 AC 784 ms
84,992 KB
testcase_37 AC 801 ms
84,992 KB
testcase_38 AC 278 ms
78,592 KB
testcase_39 AC 631 ms
85,504 KB
testcase_40 AC 363 ms
80,640 KB
testcase_41 AC 748 ms
84,864 KB
testcase_42 AC 811 ms
84,904 KB
testcase_43 AC 801 ms
84,864 KB
testcase_44 AC 795 ms
84,736 KB
testcase_45 AC 804 ms
85,120 KB
testcase_46 AC 806 ms
84,864 KB
testcase_47 AC 791 ms
84,992 KB
testcase_48 AC 613 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 = 300
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