結果

問題 No.1331 Moving Penguin
ユーザー googol_S0googol_S0
提出日時 2021-01-08 22:20:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 895 ms / 1,500 ms
コード長 500 bytes
コンパイル時間 442 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 92,892 KB
最終ジャッジ日時 2023-08-07 10:55:13
合計ジャッジ時間 34,988 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
78,016 KB
testcase_01 AC 70 ms
71,316 KB
testcase_02 AC 74 ms
75,956 KB
testcase_03 AC 71 ms
75,984 KB
testcase_04 AC 702 ms
92,484 KB
testcase_05 AC 836 ms
91,708 KB
testcase_06 AC 820 ms
91,692 KB
testcase_07 AC 829 ms
91,444 KB
testcase_08 AC 707 ms
91,412 KB
testcase_09 AC 715 ms
91,384 KB
testcase_10 AC 711 ms
91,296 KB
testcase_11 AC 716 ms
91,520 KB
testcase_12 AC 715 ms
91,456 KB
testcase_13 AC 713 ms
91,388 KB
testcase_14 AC 722 ms
91,404 KB
testcase_15 AC 722 ms
91,528 KB
testcase_16 AC 726 ms
91,488 KB
testcase_17 AC 707 ms
91,500 KB
testcase_18 AC 712 ms
91,228 KB
testcase_19 AC 715 ms
91,256 KB
testcase_20 AC 712 ms
91,744 KB
testcase_21 AC 709 ms
91,284 KB
testcase_22 AC 713 ms
91,452 KB
testcase_23 AC 719 ms
91,244 KB
testcase_24 AC 720 ms
91,260 KB
testcase_25 AC 721 ms
91,580 KB
testcase_26 AC 748 ms
92,728 KB
testcase_27 AC 741 ms
92,636 KB
testcase_28 AC 756 ms
92,672 KB
testcase_29 AC 709 ms
92,892 KB
testcase_30 AC 313 ms
81,564 KB
testcase_31 AC 467 ms
84,720 KB
testcase_32 AC 288 ms
80,752 KB
testcase_33 AC 388 ms
83,056 KB
testcase_34 AC 531 ms
87,052 KB
testcase_35 AC 892 ms
92,232 KB
testcase_36 AC 894 ms
92,160 KB
testcase_37 AC 892 ms
92,308 KB
testcase_38 AC 328 ms
81,744 KB
testcase_39 AC 737 ms
92,600 KB
testcase_40 AC 422 ms
83,824 KB
testcase_41 AC 844 ms
92,080 KB
testcase_42 AC 894 ms
92,052 KB
testcase_43 AC 895 ms
91,888 KB
testcase_44 AC 890 ms
91,796 KB
testcase_45 AC 891 ms
91,932 KB
testcase_46 AC 892 ms
91,836 KB
testcase_47 AC 890 ms
92,028 KB
testcase_48 AC 711 ms
90,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=[0]+list(map(int,input().split()))
S=301
C=[[0]*i for i in range(S)]
DP=[0]*(N+2)
mod=10**9+7
DP[1]=1
for i in range(1,N+1):
  for j in range(1,S):
    DP[i]+=C[j][i%j]
    if DP[i]>=mod:
      DP[i]-=mod
  if A[i]<S:
    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