結果

問題 No.1331 Moving Penguin
ユーザー tcltktcltk
提出日時 2021-01-20 11:56:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 778 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 86,448 KB
実行使用メモリ 307,152 KB
最終ジャッジ日時 2023-08-24 15:12:31
合計ジャッジ時間 9,377 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 234 ms
83,004 KB
testcase_02 AC 234 ms
82,716 KB
testcase_03 AC 235 ms
82,940 KB
testcase_04 AC 272 ms
96,948 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#region Header
#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
from queue import PriorityQueue
import bisect
import heapq

def input():
    return sys.stdin.readline()[:-1]

sys.setrecursionlimit(1000000)
#endregion

# _INPUT = """# paste here...
# """
# sys.stdin = io.StringIO(_INPUT)

MOD = 1000000007

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

    dp = [0 for _ in range(N)]
    dp[0] = 1
    for i in range(N-1):
        j = i + A[i]
        while j < N:
            dp[j] += dp[i]
            j += A[i]
        if A[i] != 1:
            dp[i+1] += dp[i]

    print(dp[N-1])

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