結果

問題 No.1331 Moving Penguin
ユーザー marroncastlemarroncastle
提出日時 2021-01-20 21:08:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 876 ms / 1,500 ms
コード長 527 bytes
コンパイル時間 599 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 92,528 KB
最終ジャッジ日時 2023-08-07 11:22:00
合計ジャッジ時間 36,622 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
77,328 KB
testcase_01 AC 72 ms
71,684 KB
testcase_02 AC 71 ms
71,708 KB
testcase_03 AC 72 ms
71,696 KB
testcase_04 AC 832 ms
92,528 KB
testcase_05 AC 825 ms
91,120 KB
testcase_06 AC 826 ms
90,984 KB
testcase_07 AC 825 ms
91,472 KB
testcase_08 AC 827 ms
90,460 KB
testcase_09 AC 821 ms
90,656 KB
testcase_10 AC 814 ms
90,188 KB
testcase_11 AC 822 ms
90,372 KB
testcase_12 AC 826 ms
90,308 KB
testcase_13 AC 825 ms
90,412 KB
testcase_14 AC 821 ms
90,388 KB
testcase_15 AC 828 ms
90,308 KB
testcase_16 AC 824 ms
90,412 KB
testcase_17 AC 823 ms
90,300 KB
testcase_18 AC 825 ms
90,356 KB
testcase_19 AC 820 ms
90,444 KB
testcase_20 AC 823 ms
90,108 KB
testcase_21 AC 821 ms
90,384 KB
testcase_22 AC 827 ms
90,580 KB
testcase_23 AC 820 ms
90,408 KB
testcase_24 AC 824 ms
90,576 KB
testcase_25 AC 824 ms
90,536 KB
testcase_26 AC 820 ms
92,200 KB
testcase_27 AC 828 ms
92,200 KB
testcase_28 AC 822 ms
92,040 KB
testcase_29 AC 823 ms
91,908 KB
testcase_30 AC 240 ms
81,136 KB
testcase_31 AC 415 ms
84,596 KB
testcase_32 AC 212 ms
79,772 KB
testcase_33 AC 312 ms
82,952 KB
testcase_34 AC 500 ms
86,824 KB
testcase_35 AC 861 ms
91,696 KB
testcase_36 AC 872 ms
91,584 KB
testcase_37 AC 870 ms
91,564 KB
testcase_38 AC 252 ms
81,380 KB
testcase_39 AC 794 ms
91,696 KB
testcase_40 AC 354 ms
83,496 KB
testcase_41 AC 827 ms
90,560 KB
testcase_42 AC 876 ms
91,556 KB
testcase_43 AC 858 ms
91,376 KB
testcase_44 AC 858 ms
91,592 KB
testcase_45 AC 865 ms
91,500 KB
testcase_46 AC 873 ms
91,628 KB
testcase_47 AC 875 ms
91,628 KB
testcase_48 AC 822 ms
90,480 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]*i for i in range(n+1)]
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]>n:
    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,n+1):
    cum[k][i%k] += dp[i]
    cum[k][i%k] %= MOD
print(dp[0])
  
0