結果

問題 No.1331 Moving Penguin
ユーザー 👑 tamatotamato
提出日時 2021-01-08 22:16:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 785 ms / 1,500 ms
コード長 759 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 90,624 KB
最終ジャッジ日時 2024-04-25 04:47:11
合計ジャッジ時間 34,415 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
68,096 KB
testcase_01 AC 47 ms
52,736 KB
testcase_02 AC 46 ms
58,496 KB
testcase_03 AC 48 ms
58,752 KB
testcase_04 AC 725 ms
90,368 KB
testcase_05 AC 725 ms
89,600 KB
testcase_06 AC 729 ms
89,856 KB
testcase_07 AC 728 ms
89,728 KB
testcase_08 AC 722 ms
89,344 KB
testcase_09 AC 718 ms
89,472 KB
testcase_10 AC 730 ms
89,728 KB
testcase_11 AC 728 ms
89,344 KB
testcase_12 AC 728 ms
89,600 KB
testcase_13 AC 726 ms
89,344 KB
testcase_14 AC 732 ms
89,344 KB
testcase_15 AC 721 ms
89,472 KB
testcase_16 AC 726 ms
89,344 KB
testcase_17 AC 722 ms
89,344 KB
testcase_18 AC 715 ms
89,344 KB
testcase_19 AC 715 ms
89,344 KB
testcase_20 AC 715 ms
89,344 KB
testcase_21 AC 722 ms
89,600 KB
testcase_22 AC 719 ms
89,344 KB
testcase_23 AC 719 ms
89,472 KB
testcase_24 AC 719 ms
89,472 KB
testcase_25 AC 726 ms
89,472 KB
testcase_26 AC 734 ms
89,984 KB
testcase_27 AC 734 ms
90,496 KB
testcase_28 AC 756 ms
90,624 KB
testcase_29 AC 718 ms
90,240 KB
testcase_30 AC 291 ms
77,056 KB
testcase_31 AC 454 ms
82,944 KB
testcase_32 AC 264 ms
75,648 KB
testcase_33 AC 364 ms
81,152 KB
testcase_34 AC 526 ms
85,120 KB
testcase_35 AC 769 ms
89,984 KB
testcase_36 AC 760 ms
89,856 KB
testcase_37 AC 776 ms
89,984 KB
testcase_38 AC 309 ms
79,796 KB
testcase_39 AC 715 ms
90,240 KB
testcase_40 AC 409 ms
82,432 KB
testcase_41 AC 716 ms
89,728 KB
testcase_42 AC 753 ms
89,728 KB
testcase_43 AC 753 ms
90,112 KB
testcase_44 AC 753 ms
89,856 KB
testcase_45 AC 749 ms
89,984 KB
testcase_46 AC 783 ms
90,240 KB
testcase_47 AC 785 ms
90,112 KB
testcase_48 AC 730 ms
89,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    A = list(map(int, input().split()))

    block_size = 320
    add = [[0] * i for i in range(block_size+1)]

    ans = [0] * N
    ans[0] = 1
    for i, a in enumerate(A):
        for d in range(1, block_size+1):
            ans[i] = (ans[i] + add[d][i % d])%mod
        if a <= block_size:
            add[a][i%a] = (add[a][i%a] + ans[i])%mod
        else:
            for j in range(1, N+1):
                if i+j*a >= N:
                    break
                ans[i+j*a] = (ans[i+j*a] + ans[i])%mod
        if a != 1 and i+1 != N:
            ans[i+1] = (ans[i+1] + ans[i])%mod
    print(ans[-1])


if __name__ == '__main__':
    main()
0