結果

問題 No.1331 Moving Penguin
ユーザー googol_S0googol_S0
提出日時 2021-01-08 22:16:50
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 504 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 95,360 KB
最終ジャッジ日時 2024-04-28 03:32:13
合計ジャッジ時間 4,284 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 212 ms
73,728 KB
testcase_01 AC 42 ms
61,952 KB
testcase_02 AC 42 ms
62,848 KB
testcase_03 AC 43 ms
62,976 KB
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 AC 688 ms
83,712 KB
testcase_31 AC 1,108 ms
87,680 KB
testcase_32 AC 614 ms
83,328 KB
testcase_33 AC 892 ms
85,632 KB
testcase_34 AC 1,297 ms
89,856 KB
testcase_35 TLE -
testcase_36 TLE -
testcase_37 TLE -
testcase_38 AC 736 ms
83,968 KB
testcase_39 TLE -
testcase_40 AC 1,035 ms
86,144 KB
testcase_41 TLE -
testcase_42 TLE -
testcase_43 TLE -
testcase_44 TLE -
testcase_45 TLE -
testcase_46 TLE -
testcase_47 TLE -
testcase_48 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=[0]+list(map(int,input().split()))
C=[[0]*i for i in range(1001)]
DP=[0]*(N+2)
mod=10**9+7
DP[1]=1
for i in range(1,N+1):
  for j in range(1,1001):
    DP[i]+=C[j][i%j]
    if DP[i]>=mod:
      DP[i]-=mod
  if A[i]<=1000:
    m=i%A[i]
    C[A[i]][m]+=DP[i]
    if C[A[i]][m]>=mod:
      C[A[i]][m]-=mod
  else:
    for j in range(i+A[i],N+1,A[i]):
      DP[j]+=DP[i]
      if DP[j]>=mod:
        DP[j]-=mod
  if A[i]>1:
    DP[i+1]+=DP[i]
  if DP[i+1]>=mod:
    DP[i+1]-=mod
print(DP[N])
0