結果

問題 No.1973 Divisor Sequence
ユーザー titan23titan23
提出日時 2022-06-24 09:12:58
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 811 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 82,512 KB
実行使用メモリ 290,644 KB
最終ジャッジ日時 2024-04-25 15:26:16
合計ジャッジ時間 9,581 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
62,448 KB
testcase_01 AC 42 ms
54,256 KB
testcase_02 AC 473 ms
246,880 KB
testcase_03 AC 81 ms
80,416 KB
testcase_04 AC 302 ms
176,508 KB
testcase_05 AC 117 ms
98,472 KB
testcase_06 AC 314 ms
182,796 KB
testcase_07 AC 111 ms
94,300 KB
testcase_08 AC 204 ms
132,384 KB
testcase_09 AC 282 ms
163,912 KB
testcase_10 AC 350 ms
187,848 KB
testcase_11 AC 93 ms
83,808 KB
testcase_12 AC 276 ms
161,836 KB
testcase_13 AC 128 ms
101,708 KB
testcase_14 AC 278 ms
138,920 KB
testcase_15 AC 422 ms
225,532 KB
testcase_16 AC 408 ms
222,332 KB
testcase_17 AC 301 ms
169,448 KB
testcase_18 AC 87 ms
78,008 KB
testcase_19 AC 382 ms
199,148 KB
testcase_20 AC 105 ms
87,576 KB
testcase_21 AC 373 ms
206,628 KB
testcase_22 AC 349 ms
196,812 KB
testcase_23 TLE -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

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())

div = factorization(m)

def dp(e):
  dp = [[0]*(e+1) for _ in range(n+1)]
  for i in range(e+1):
    dp[0][i] = 1
  for i in range(n):
    for j in range(e+1):
      for k in range(e-j+1):
        dp[i+1][j] += dp[i][k]
        dp[i+1][j] %= mod
  return dp[-1][0]

ans = 1
for p,e in div.items():
  ans *= dp(e)
  ans %= mod

print(ans)
0