結果

問題 No.1331 Moving Penguin
ユーザー marroncastlemarroncastle
提出日時 2021-01-20 21:18:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 572 ms / 1,500 ms
コード長 533 bytes
コンパイル時間 242 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 90,760 KB
最終ジャッジ日時 2024-04-25 05:15:07
合計ジャッジ時間 22,071 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
69,120 KB
testcase_01 AC 38 ms
52,992 KB
testcase_02 AC 38 ms
53,248 KB
testcase_03 AC 40 ms
59,008 KB
testcase_04 AC 476 ms
89,600 KB
testcase_05 AC 467 ms
86,400 KB
testcase_06 AC 476 ms
86,400 KB
testcase_07 AC 464 ms
86,400 KB
testcase_08 AC 463 ms
86,144 KB
testcase_09 AC 494 ms
86,016 KB
testcase_10 AC 460 ms
86,144 KB
testcase_11 AC 462 ms
86,272 KB
testcase_12 AC 461 ms
86,016 KB
testcase_13 AC 463 ms
86,016 KB
testcase_14 AC 460 ms
86,016 KB
testcase_15 AC 461 ms
86,144 KB
testcase_16 AC 465 ms
86,016 KB
testcase_17 AC 464 ms
85,120 KB
testcase_18 AC 457 ms
85,504 KB
testcase_19 AC 459 ms
85,248 KB
testcase_20 AC 461 ms
85,120 KB
testcase_21 AC 463 ms
85,248 KB
testcase_22 AC 460 ms
85,376 KB
testcase_23 AC 465 ms
86,400 KB
testcase_24 AC 476 ms
86,016 KB
testcase_25 AC 480 ms
86,400 KB
testcase_26 AC 503 ms
90,624 KB
testcase_27 AC 487 ms
90,760 KB
testcase_28 AC 486 ms
90,624 KB
testcase_29 AC 465 ms
87,856 KB
testcase_30 AC 206 ms
76,288 KB
testcase_31 AC 303 ms
83,584 KB
testcase_32 AC 198 ms
75,008 KB
testcase_33 AC 254 ms
79,872 KB
testcase_34 AC 349 ms
85,760 KB
testcase_35 AC 536 ms
90,368 KB
testcase_36 AC 532 ms
90,240 KB
testcase_37 AC 542 ms
90,368 KB
testcase_38 AC 214 ms
76,928 KB
testcase_39 AC 474 ms
90,624 KB
testcase_40 AC 272 ms
80,512 KB
testcase_41 AC 528 ms
90,368 KB
testcase_42 AC 541 ms
90,240 KB
testcase_43 AC 541 ms
90,368 KB
testcase_44 AC 553 ms
90,240 KB
testcase_45 AC 530 ms
90,440 KB
testcase_46 AC 537 ms
90,368 KB
testcase_47 AC 572 ms
90,340 KB
testcase_48 AC 471 ms
85,248 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]*(201) for _ in range(201)]
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]>200:
    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,201):
    cum[k][i%k] += dp[i]
    cum[k][i%k] %= MOD
print(dp[0])
  
0