結果

問題 No.1331 Moving Penguin
ユーザー googol_S0googol_S0
提出日時 2021-01-08 22:20:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 861 ms / 1,500 ms
コード長 500 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 91,904 KB
最終ジャッジ日時 2024-04-25 04:48:44
合計ジャッジ時間 31,759 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
71,680 KB
testcase_01 AC 41 ms
52,608 KB
testcase_02 AC 46 ms
58,496 KB
testcase_03 AC 46 ms
58,496 KB
testcase_04 AC 656 ms
91,904 KB
testcase_05 AC 795 ms
90,496 KB
testcase_06 AC 777 ms
90,752 KB
testcase_07 AC 787 ms
90,752 KB
testcase_08 AC 655 ms
88,832 KB
testcase_09 AC 649 ms
88,960 KB
testcase_10 AC 656 ms
88,704 KB
testcase_11 AC 664 ms
88,576 KB
testcase_12 AC 650 ms
90,368 KB
testcase_13 AC 656 ms
88,320 KB
testcase_14 AC 674 ms
88,576 KB
testcase_15 AC 681 ms
88,704 KB
testcase_16 AC 674 ms
88,448 KB
testcase_17 AC 647 ms
87,680 KB
testcase_18 AC 649 ms
87,552 KB
testcase_19 AC 669 ms
87,424 KB
testcase_20 AC 661 ms
90,368 KB
testcase_21 AC 664 ms
90,240 KB
testcase_22 AC 658 ms
90,496 KB
testcase_23 AC 658 ms
88,704 KB
testcase_24 AC 658 ms
88,704 KB
testcase_25 AC 662 ms
89,216 KB
testcase_26 AC 688 ms
91,776 KB
testcase_27 AC 677 ms
91,648 KB
testcase_28 AC 681 ms
91,648 KB
testcase_29 AC 649 ms
88,320 KB
testcase_30 AC 287 ms
80,000 KB
testcase_31 AC 427 ms
83,584 KB
testcase_32 AC 257 ms
79,360 KB
testcase_33 AC 349 ms
81,792 KB
testcase_34 AC 492 ms
86,144 KB
testcase_35 AC 847 ms
91,264 KB
testcase_36 AC 827 ms
91,136 KB
testcase_37 AC 824 ms
91,392 KB
testcase_38 AC 295 ms
80,384 KB
testcase_39 AC 666 ms
91,392 KB
testcase_40 AC 380 ms
82,944 KB
testcase_41 AC 777 ms
91,264 KB
testcase_42 AC 822 ms
90,752 KB
testcase_43 AC 861 ms
90,880 KB
testcase_44 AC 825 ms
90,752 KB
testcase_45 AC 834 ms
90,880 KB
testcase_46 AC 830 ms
90,880 KB
testcase_47 AC 829 ms
90,880 KB
testcase_48 AC 646 ms
86,144 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