結果

問題 No.1973 Divisor Sequence
ユーザー titan23titan23
提出日時 2022-06-24 09:13:49
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 809 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 82,540 KB
実行使用メモリ 297,032 KB
最終ジャッジ日時 2024-04-25 15:26:32
合計ジャッジ時間 10,369 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
55,100 KB
testcase_01 AC 42 ms
54,148 KB
testcase_02 AC 485 ms
247,360 KB
testcase_03 AC 80 ms
80,916 KB
testcase_04 AC 315 ms
176,448 KB
testcase_05 AC 120 ms
98,768 KB
testcase_06 AC 330 ms
182,808 KB
testcase_07 AC 113 ms
94,520 KB
testcase_08 AC 212 ms
132,636 KB
testcase_09 AC 281 ms
163,884 KB
testcase_10 AC 341 ms
188,028 KB
testcase_11 AC 89 ms
83,864 KB
testcase_12 AC 280 ms
161,800 KB
testcase_13 AC 128 ms
101,596 KB
testcase_14 AC 268 ms
139,132 KB
testcase_15 AC 429 ms
225,284 KB
testcase_16 AC 422 ms
222,240 KB
testcase_17 AC 310 ms
169,472 KB
testcase_18 AC 82 ms
78,248 KB
testcase_19 AC 369 ms
198,948 KB
testcase_20 AC 114 ms
90,584 KB
testcase_21 AC 382 ms
206,808 KB
testcase_22 AC 354 ms
196,896 KB
testcase_23 TLE -
testcase_24 AC 1,193 ms
297,032 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())

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