結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
66,304 KB
testcase_01 AC 42 ms
51,968 KB
testcase_02 AC 44 ms
52,224 KB
testcase_03 AC 42 ms
52,096 KB
testcase_04 AC 195 ms
88,832 KB
testcase_05 AC 329 ms
89,600 KB
testcase_06 AC 332 ms
89,728 KB
testcase_07 AC 315 ms
89,600 KB
testcase_08 AC 191 ms
85,504 KB
testcase_09 AC 190 ms
85,632 KB
testcase_10 AC 189 ms
85,632 KB
testcase_11 AC 191 ms
85,760 KB
testcase_12 AC 189 ms
85,632 KB
testcase_13 AC 190 ms
85,376 KB
testcase_14 AC 190 ms
85,760 KB
testcase_15 AC 187 ms
85,504 KB
testcase_16 AC 189 ms
85,632 KB
testcase_17 AC 183 ms
84,992 KB
testcase_18 AC 185 ms
84,864 KB
testcase_19 AC 185 ms
84,736 KB
testcase_20 AC 187 ms
84,480 KB
testcase_21 AC 185 ms
84,608 KB
testcase_22 AC 184 ms
84,608 KB
testcase_23 AC 201 ms
85,888 KB
testcase_24 AC 197 ms
85,504 KB
testcase_25 AC 200 ms
85,760 KB
testcase_26 AC 240 ms
90,240 KB
testcase_27 AC 239 ms
89,984 KB
testcase_28 AC 242 ms
90,368 KB
testcase_29 AC 211 ms
87,168 KB
testcase_30 AC 119 ms
74,240 KB
testcase_31 AC 156 ms
82,944 KB
testcase_32 AC 109 ms
73,344 KB
testcase_33 AC 130 ms
77,184 KB
testcase_34 AC 169 ms
85,248 KB
testcase_35 AC 259 ms
89,728 KB
testcase_36 AC 260 ms
89,856 KB
testcase_37 AC 258 ms
89,856 KB
testcase_38 AC 115 ms
74,624 KB
testcase_39 AC 206 ms
89,984 KB
testcase_40 AC 136 ms
79,232 KB
testcase_41 AC 271 ms
89,856 KB
testcase_42 AC 257 ms
89,728 KB
testcase_43 AC 253 ms
89,856 KB
testcase_44 AC 257 ms
89,984 KB
testcase_45 AC 256 ms
89,984 KB
testcase_46 AC 259 ms
89,856 KB
testcase_47 AC 257 ms
89,856 KB
testcase_48 AC 183 ms
84,608 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]*(51) for _ in range(51)]
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]>50:
    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,51):
    cum[k][i%k] += dp[i]
    cum[k][i%k] %= MOD
print(dp[0])
  
0