結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
66,560 KB
testcase_01 AC 36 ms
52,096 KB
testcase_02 AC 37 ms
52,352 KB
testcase_03 AC 35 ms
52,096 KB
testcase_04 AC 177 ms
88,704 KB
testcase_05 AC 278 ms
89,728 KB
testcase_06 AC 288 ms
89,472 KB
testcase_07 AC 281 ms
89,600 KB
testcase_08 AC 172 ms
85,632 KB
testcase_09 AC 167 ms
85,504 KB
testcase_10 AC 167 ms
85,632 KB
testcase_11 AC 167 ms
85,632 KB
testcase_12 AC 165 ms
85,632 KB
testcase_13 AC 167 ms
85,632 KB
testcase_14 AC 170 ms
85,632 KB
testcase_15 AC 173 ms
85,760 KB
testcase_16 AC 166 ms
85,632 KB
testcase_17 AC 162 ms
84,864 KB
testcase_18 AC 170 ms
84,608 KB
testcase_19 AC 166 ms
84,736 KB
testcase_20 AC 164 ms
84,864 KB
testcase_21 AC 170 ms
84,480 KB
testcase_22 AC 170 ms
84,736 KB
testcase_23 AC 167 ms
85,760 KB
testcase_24 AC 168 ms
85,760 KB
testcase_25 AC 167 ms
85,632 KB
testcase_26 AC 185 ms
90,240 KB
testcase_27 AC 185 ms
90,112 KB
testcase_28 AC 183 ms
90,240 KB
testcase_29 AC 168 ms
87,296 KB
testcase_30 AC 100 ms
74,368 KB
testcase_31 AC 135 ms
82,944 KB
testcase_32 AC 99 ms
73,344 KB
testcase_33 AC 111 ms
77,312 KB
testcase_34 AC 149 ms
85,376 KB
testcase_35 AC 229 ms
89,856 KB
testcase_36 AC 228 ms
89,600 KB
testcase_37 AC 228 ms
89,728 KB
testcase_38 AC 105 ms
74,624 KB
testcase_39 AC 187 ms
90,368 KB
testcase_40 AC 120 ms
79,232 KB
testcase_41 AC 252 ms
89,856 KB
testcase_42 AC 229 ms
89,856 KB
testcase_43 AC 231 ms
89,856 KB
testcase_44 AC 228 ms
89,856 KB
testcase_45 AC 229 ms
89,856 KB
testcase_46 AC 226 ms
89,600 KB
testcase_47 AC 226 ms
89,856 KB
testcase_48 AC 164 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