結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
67,328 KB
testcase_01 AC 37 ms
52,224 KB
testcase_02 AC 37 ms
52,352 KB
testcase_03 AC 36 ms
52,352 KB
testcase_04 AC 762 ms
91,520 KB
testcase_05 AC 723 ms
86,784 KB
testcase_06 AC 733 ms
87,040 KB
testcase_07 AC 732 ms
86,912 KB
testcase_08 AC 729 ms
86,656 KB
testcase_09 AC 740 ms
86,400 KB
testcase_10 AC 752 ms
86,528 KB
testcase_11 AC 741 ms
86,400 KB
testcase_12 AC 728 ms
86,400 KB
testcase_13 AC 773 ms
86,528 KB
testcase_14 AC 740 ms
86,656 KB
testcase_15 AC 730 ms
86,528 KB
testcase_16 AC 728 ms
86,656 KB
testcase_17 AC 745 ms
85,632 KB
testcase_18 AC 727 ms
85,888 KB
testcase_19 AC 717 ms
85,760 KB
testcase_20 AC 729 ms
85,504 KB
testcase_21 AC 723 ms
85,376 KB
testcase_22 AC 716 ms
85,632 KB
testcase_23 AC 726 ms
86,272 KB
testcase_24 AC 734 ms
86,528 KB
testcase_25 AC 736 ms
86,400 KB
testcase_26 AC 717 ms
91,008 KB
testcase_27 AC 715 ms
91,008 KB
testcase_28 AC 714 ms
91,136 KB
testcase_29 AC 721 ms
88,320 KB
testcase_30 AC 191 ms
76,032 KB
testcase_31 AC 354 ms
83,456 KB
testcase_32 AC 185 ms
74,880 KB
testcase_33 AC 259 ms
79,616 KB
testcase_34 AC 428 ms
85,632 KB
testcase_35 AC 747 ms
90,368 KB
testcase_36 AC 770 ms
90,752 KB
testcase_37 AC 766 ms
90,624 KB
testcase_38 AC 201 ms
76,160 KB
testcase_39 AC 689 ms
90,880 KB
testcase_40 AC 304 ms
82,560 KB
testcase_41 AC 731 ms
86,784 KB
testcase_42 AC 752 ms
90,752 KB
testcase_43 AC 759 ms
90,624 KB
testcase_44 AC 764 ms
90,624 KB
testcase_45 AC 789 ms
90,624 KB
testcase_46 AC 782 ms
90,752 KB
testcase_47 AC 784 ms
90,624 KB
testcase_48 AC 729 ms
85,504 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]*(n+1) for _ 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