結果

問題 No.1331 Moving Penguin
ユーザー marroncastlemarroncastle
提出日時 2021-01-20 21:16:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 377 ms / 1,500 ms
コード長 529 bytes
コンパイル時間 353 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 92,104 KB
最終ジャッジ日時 2023-08-07 11:22:25
合計ジャッジ時間 10,926 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
77,308 KB
testcase_01 AC 73 ms
71,756 KB
testcase_02 AC 69 ms
71,616 KB
testcase_03 AC 70 ms
71,696 KB
testcase_04 AC 164 ms
92,104 KB
testcase_05 AC 377 ms
90,844 KB
testcase_06 AC 376 ms
90,848 KB
testcase_07 AC 361 ms
91,188 KB
testcase_08 AC 164 ms
90,300 KB
testcase_09 AC 164 ms
90,272 KB
testcase_10 AC 163 ms
90,312 KB
testcase_11 AC 164 ms
90,316 KB
testcase_12 AC 162 ms
90,304 KB
testcase_13 AC 164 ms
90,144 KB
testcase_14 AC 164 ms
90,536 KB
testcase_15 AC 161 ms
90,380 KB
testcase_16 AC 163 ms
90,512 KB
testcase_17 AC 160 ms
90,400 KB
testcase_18 AC 160 ms
90,584 KB
testcase_19 AC 159 ms
90,592 KB
testcase_20 AC 158 ms
90,396 KB
testcase_21 AC 158 ms
90,424 KB
testcase_22 AC 159 ms
90,424 KB
testcase_23 AC 159 ms
90,376 KB
testcase_24 AC 161 ms
90,272 KB
testcase_25 AC 162 ms
90,412 KB
testcase_26 AC 178 ms
91,520 KB
testcase_27 AC 182 ms
91,572 KB
testcase_28 AC 179 ms
91,312 KB
testcase_29 AC 164 ms
91,672 KB
testcase_30 AC 120 ms
80,468 KB
testcase_31 AC 141 ms
84,280 KB
testcase_32 AC 113 ms
79,920 KB
testcase_33 AC 126 ms
82,384 KB
testcase_34 AC 148 ms
86,376 KB
testcase_35 AC 226 ms
91,016 KB
testcase_36 AC 226 ms
91,128 KB
testcase_37 AC 224 ms
91,100 KB
testcase_38 AC 119 ms
80,476 KB
testcase_39 AC 175 ms
91,480 KB
testcase_40 AC 132 ms
83,472 KB
testcase_41 AC 237 ms
91,072 KB
testcase_42 AC 228 ms
90,840 KB
testcase_43 AC 224 ms
91,012 KB
testcase_44 AC 226 ms
91,032 KB
testcase_45 AC 226 ms
90,940 KB
testcase_46 AC 224 ms
91,056 KB
testcase_47 AC 224 ms
90,936 KB
testcase_48 AC 160 ms
90,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,os,io
input = sys.stdin.readline
#input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
N = int(input())
A = list(map(int, input().split()))
n = int(N**.5)+1
cum = [[0]*(31) for _ in range(31)]
dp = [0]*N
dp[-1] = 1
MOD = 10**9+7
for i in range(N-1,-1,-1):
  if A[i]>1 and i<N-1:
    dp[i] += dp[i+1]
  if A[i]>30:
    for j in range(i+A[i],N,A[i]):
      dp[i] += dp[j]
  else:
    dp[i] += cum[A[i]][i%A[i]]
  dp[i] %= MOD
  for k in range(1,31):
    cum[k][i%k] += dp[i]
    cum[k][i%k] %= MOD
print(dp[0])
  
0