結果

問題 No.1973 Divisor Sequence
ユーザー titan23titan23
提出日時 2022-06-24 09:21:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,228 ms / 2,000 ms
コード長 827 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 82,440 KB
実行使用メモリ 368,904 KB
最終ジャッジ日時 2024-04-25 15:29:53
合計ジャッジ時間 8,441 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
55,708 KB
testcase_01 AC 40 ms
54,452 KB
testcase_02 AC 455 ms
248,256 KB
testcase_03 AC 83 ms
81,092 KB
testcase_04 AC 307 ms
177,192 KB
testcase_05 AC 119 ms
99,264 KB
testcase_06 AC 314 ms
183,864 KB
testcase_07 AC 107 ms
89,432 KB
testcase_08 AC 205 ms
133,204 KB
testcase_09 AC 274 ms
164,636 KB
testcase_10 AC 359 ms
188,264 KB
testcase_11 AC 95 ms
84,004 KB
testcase_12 AC 270 ms
162,768 KB
testcase_13 AC 137 ms
101,984 KB
testcase_14 AC 250 ms
140,028 KB
testcase_15 AC 417 ms
226,212 KB
testcase_16 AC 412 ms
223,356 KB
testcase_17 AC 309 ms
169,772 KB
testcase_18 AC 94 ms
79,748 KB
testcase_19 AC 394 ms
199,604 KB
testcase_20 AC 123 ms
96,272 KB
testcase_21 AC 375 ms
208,020 KB
testcase_22 AC 343 ms
197,016 KB
testcase_23 AC 718 ms
283,908 KB
testcase_24 AC 1,228 ms
368,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda: sys.stdin.readline().rstrip()
mod = 1000000007

from collections import Counter
def factorization(n: int) -> Counter:
  ret = Counter()
  tmp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if tmp % i == 0:
      cnt = 0
      while tmp % i == 0:
        cnt += 1
        tmp //= i
      ret[i] = cnt
  if tmp != 1:
    ret[tmp] = 1
  if ret == []:
    ret[n] = 1
  return ret

#  -----------------------  #

n, m = map(int, input().split())

ans = 1
for p,e in factorization(m).items():
  dp = [[0]*(e+1) for _ in range(n+1)]
  for i in range(e+1):
    dp[0][i] = 1

  for i in range(n):
    acc = [0] * (e+2)
    for j in range(e+1):
      acc[j+1] += acc[j] + dp[i][j]
    for j in range(e+1):
      dp[i+1][j] += acc[e-j+1]
      dp[i+1][j] %= mod

  ans *= dp[-1][0]
  ans %= mod

print(ans)
0