結果

問題 No.1331 Moving Penguin
ユーザー marroncastlemarroncastle
提出日時 2021-01-20 21:12:24
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 394 ms / 1,500 ms
コード長 533 bytes
コンパイル時間 681 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 92,220 KB
最終ジャッジ日時 2023-08-07 11:21:23
合計ジャッジ時間 16,750 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
77,164 KB
testcase_01 AC 71 ms
71,792 KB
testcase_02 AC 71 ms
71,608 KB
testcase_03 AC 70 ms
71,596 KB
testcase_04 AC 327 ms
92,220 KB
testcase_05 AC 315 ms
90,816 KB
testcase_06 AC 314 ms
90,496 KB
testcase_07 AC 315 ms
90,652 KB
testcase_08 AC 316 ms
90,536 KB
testcase_09 AC 315 ms
90,268 KB
testcase_10 AC 316 ms
90,368 KB
testcase_11 AC 315 ms
90,460 KB
testcase_12 AC 315 ms
90,504 KB
testcase_13 AC 315 ms
90,456 KB
testcase_14 AC 314 ms
90,480 KB
testcase_15 AC 314 ms
90,328 KB
testcase_16 AC 314 ms
90,444 KB
testcase_17 AC 309 ms
90,312 KB
testcase_18 AC 312 ms
90,376 KB
testcase_19 AC 313 ms
90,356 KB
testcase_20 AC 312 ms
90,296 KB
testcase_21 AC 312 ms
90,400 KB
testcase_22 AC 310 ms
90,460 KB
testcase_23 AC 311 ms
90,140 KB
testcase_24 AC 314 ms
90,528 KB
testcase_25 AC 315 ms
90,136 KB
testcase_26 AC 332 ms
91,804 KB
testcase_27 AC 330 ms
91,648 KB
testcase_28 AC 336 ms
91,408 KB
testcase_29 AC 316 ms
91,616 KB
testcase_30 AC 171 ms
81,244 KB
testcase_31 AC 228 ms
84,176 KB
testcase_32 AC 158 ms
79,580 KB
testcase_33 AC 195 ms
81,804 KB
testcase_34 AC 252 ms
86,840 KB
testcase_35 AC 387 ms
91,268 KB
testcase_36 AC 387 ms
91,216 KB
testcase_37 AC 388 ms
91,044 KB
testcase_38 AC 173 ms
80,640 KB
testcase_39 AC 326 ms
91,272 KB
testcase_40 AC 211 ms
83,448 KB
testcase_41 AC 394 ms
91,268 KB
testcase_42 AC 383 ms
91,296 KB
testcase_43 AC 383 ms
91,292 KB
testcase_44 AC 383 ms
91,352 KB
testcase_45 AC 383 ms
91,024 KB
testcase_46 AC 380 ms
91,264 KB
testcase_47 AC 382 ms
91,332 KB
testcase_48 AC 311 ms
90,252 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]*(101) for _ in range(101)]
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]>100:
    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,101):
    cum[k][i%k] += dp[i]
    cum[k][i%k] %= MOD
print(dp[0])
  
0