結果

問題 No.1331 Moving Penguin
ユーザー titiatitia
提出日時 2021-01-08 22:24:12
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 578 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 82,104 KB
実行使用メモリ 347,032 KB
最終ジャッジ日時 2024-04-28 03:46:02
合計ジャッジ時間 62,633 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 174 ms
90,640 KB
testcase_01 AC 44 ms
57,600 KB
testcase_02 AC 43 ms
57,856 KB
testcase_03 AC 44 ms
57,856 KB
testcase_04 TLE -
testcase_05 AC 1,416 ms
343,416 KB
testcase_06 TLE -
testcase_07 AC 1,438 ms
343,140 KB
testcase_08 TLE -
testcase_09 TLE -
testcase_10 AC 1,398 ms
342,368 KB
testcase_11 AC 1,443 ms
342,352 KB
testcase_12 AC 1,438 ms
342,472 KB
testcase_13 TLE -
testcase_14 AC 1,444 ms
342,380 KB
testcase_15 AC 1,414 ms
342,788 KB
testcase_16 TLE -
testcase_17 AC 1,228 ms
342,632 KB
testcase_18 AC 1,159 ms
342,376 KB
testcase_19 AC 1,182 ms
342,500 KB
testcase_20 AC 1,118 ms
342,628 KB
testcase_21 AC 1,278 ms
342,604 KB
testcase_22 AC 1,217 ms
342,616 KB
testcase_23 AC 1,485 ms
342,220 KB
testcase_24 AC 1,414 ms
342,752 KB
testcase_25 AC 1,425 ms
342,760 KB
testcase_26 AC 1,460 ms
344,276 KB
testcase_27 TLE -
testcase_28 AC 1,474 ms
344,408 KB
testcase_29 AC 1,406 ms
343,740 KB
testcase_30 AC 549 ms
166,900 KB
testcase_31 AC 976 ms
238,156 KB
testcase_32 AC 438 ms
155,176 KB
testcase_33 AC 620 ms
199,636 KB
testcase_34 AC 1,120 ms
251,816 KB
testcase_35 TLE -
testcase_36 TLE -
testcase_37 AC 1,493 ms
343,592 KB
testcase_38 AC 549 ms
172,120 KB
testcase_39 AC 1,425 ms
334,568 KB
testcase_40 AC 668 ms
218,212 KB
testcase_41 TLE -
testcase_42 AC 1,486 ms
344,324 KB
testcase_43 AC 1,418 ms
343,088 KB
testcase_44 TLE -
testcase_45 TLE -
testcase_46 AC 1,395 ms
343,436 KB
testcase_47 AC 1,388 ms
343,588 KB
testcase_48 AC 1,403 ms
342,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))
mod=10**9+7


DP=[[0]*(N+1) for i in range(351)]
DP[0][0]=1

for i in range(N):
    a=A[i]
    for j in range(1,351):
        if i-j>=0:
            DP[j][i]+=DP[j][i-j]
            DP[j][i]%=mod

            DP[0][i]+=DP[j][i]
            DP[0][i]%=mod
            
    if a>350:
        for j in range(i+a,N,a):
            DP[0][j]+=DP[0][i]

    else:
        DP[a][i]+=DP[0][i]
        DP[a][i]%=mod

    if a!=1:
        DP[0][i+1]+=DP[0][i]
        DP[0][i+1]%=mod

print(DP[0][N-1])
0