結果

問題 No.1331 Moving Penguin
ユーザー marroncastlemarroncastle
提出日時 2021-01-20 21:07:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 886 ms / 1,500 ms
コード長 422 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 92,032 KB
最終ジャッジ日時 2024-04-25 05:13:26
合計ジャッジ時間 36,199 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
67,456 KB
testcase_01 AC 42 ms
52,352 KB
testcase_02 AC 42 ms
52,224 KB
testcase_03 AC 41 ms
52,096 KB
testcase_04 AC 826 ms
92,032 KB
testcase_05 AC 810 ms
87,168 KB
testcase_06 AC 804 ms
86,784 KB
testcase_07 AC 807 ms
86,784 KB
testcase_08 AC 809 ms
86,400 KB
testcase_09 AC 814 ms
86,144 KB
testcase_10 AC 811 ms
86,272 KB
testcase_11 AC 806 ms
86,144 KB
testcase_12 AC 807 ms
86,272 KB
testcase_13 AC 810 ms
86,400 KB
testcase_14 AC 810 ms
86,528 KB
testcase_15 AC 805 ms
86,272 KB
testcase_16 AC 809 ms
86,784 KB
testcase_17 AC 812 ms
85,760 KB
testcase_18 AC 803 ms
85,504 KB
testcase_19 AC 795 ms
85,376 KB
testcase_20 AC 803 ms
85,376 KB
testcase_21 AC 812 ms
85,504 KB
testcase_22 AC 803 ms
85,248 KB
testcase_23 AC 803 ms
86,144 KB
testcase_24 AC 810 ms
86,272 KB
testcase_25 AC 814 ms
86,272 KB
testcase_26 AC 819 ms
91,264 KB
testcase_27 AC 818 ms
91,264 KB
testcase_28 AC 824 ms
91,136 KB
testcase_29 AC 807 ms
88,704 KB
testcase_30 AC 222 ms
76,032 KB
testcase_31 AC 411 ms
83,456 KB
testcase_32 AC 200 ms
74,752 KB
testcase_33 AC 303 ms
79,744 KB
testcase_34 AC 496 ms
85,888 KB
testcase_35 AC 861 ms
90,752 KB
testcase_36 AC 870 ms
90,752 KB
testcase_37 AC 869 ms
90,752 KB
testcase_38 AC 230 ms
76,032 KB
testcase_39 AC 778 ms
91,264 KB
testcase_40 AC 350 ms
82,560 KB
testcase_41 AC 805 ms
86,528 KB
testcase_42 AC 850 ms
90,624 KB
testcase_43 AC 862 ms
90,624 KB
testcase_44 AC 857 ms
90,624 KB
testcase_45 AC 857 ms
90,624 KB
testcase_46 AC 876 ms
90,624 KB
testcase_47 AC 886 ms
90,496 KB
testcase_48 AC 808 ms
85,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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