結果

問題 No.1331 Moving Penguin
ユーザー marroncastlemarroncastle
提出日時 2021-01-20 21:22:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 319 ms / 1,500 ms
コード長 529 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 90,240 KB
最終ジャッジ日時 2024-04-25 05:15:57
合計ジャッジ時間 12,989 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
67,584 KB
testcase_01 AC 44 ms
52,352 KB
testcase_02 AC 41 ms
52,096 KB
testcase_03 AC 43 ms
52,224 KB
testcase_04 AC 244 ms
89,088 KB
testcase_05 AC 314 ms
89,600 KB
testcase_06 AC 311 ms
89,600 KB
testcase_07 AC 311 ms
89,600 KB
testcase_08 AC 232 ms
85,632 KB
testcase_09 AC 235 ms
85,632 KB
testcase_10 AC 231 ms
85,888 KB
testcase_11 AC 232 ms
85,760 KB
testcase_12 AC 232 ms
85,504 KB
testcase_13 AC 233 ms
85,760 KB
testcase_14 AC 233 ms
85,504 KB
testcase_15 AC 233 ms
85,760 KB
testcase_16 AC 230 ms
85,632 KB
testcase_17 AC 228 ms
84,992 KB
testcase_18 AC 228 ms
84,736 KB
testcase_19 AC 230 ms
84,736 KB
testcase_20 AC 228 ms
84,736 KB
testcase_21 AC 233 ms
84,608 KB
testcase_22 AC 228 ms
84,736 KB
testcase_23 AC 233 ms
85,504 KB
testcase_24 AC 236 ms
85,632 KB
testcase_25 AC 232 ms
85,376 KB
testcase_26 AC 259 ms
90,112 KB
testcase_27 AC 256 ms
90,240 KB
testcase_28 AC 260 ms
90,240 KB
testcase_29 AC 232 ms
87,680 KB
testcase_30 AC 132 ms
75,520 KB
testcase_31 AC 180 ms
82,944 KB
testcase_32 AC 121 ms
73,472 KB
testcase_33 AC 151 ms
77,440 KB
testcase_34 AC 199 ms
85,248 KB
testcase_35 AC 303 ms
89,984 KB
testcase_36 AC 305 ms
89,728 KB
testcase_37 AC 309 ms
89,856 KB
testcase_38 AC 132 ms
74,496 KB
testcase_39 AC 251 ms
89,856 KB
testcase_40 AC 163 ms
79,488 KB
testcase_41 AC 319 ms
89,600 KB
testcase_42 AC 301 ms
89,856 KB
testcase_43 AC 305 ms
89,728 KB
testcase_44 AC 303 ms
89,856 KB
testcase_45 AC 302 ms
89,856 KB
testcase_46 AC 300 ms
89,984 KB
testcase_47 AC 308 ms
89,856 KB
testcase_48 AC 229 ms
84,736 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]*(71) for _ in range(71)]
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]>70:
    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,71):
    cum[k][i%k] += dp[i]
    cum[k][i%k] %= MOD
print(dp[0])
  
0