結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
54,784 KB
testcase_01 AC 38 ms
54,692 KB
testcase_02 AC 447 ms
248,188 KB
testcase_03 AC 80 ms
81,136 KB
testcase_04 AC 296 ms
177,356 KB
testcase_05 AC 113 ms
99,324 KB
testcase_06 AC 300 ms
183,836 KB
testcase_07 AC 104 ms
89,444 KB
testcase_08 AC 200 ms
133,116 KB
testcase_09 AC 269 ms
164,280 KB
testcase_10 AC 357 ms
188,196 KB
testcase_11 AC 104 ms
84,512 KB
testcase_12 AC 282 ms
162,868 KB
testcase_13 AC 137 ms
102,136 KB
testcase_14 AC 249 ms
140,028 KB
testcase_15 AC 406 ms
226,524 KB
testcase_16 AC 398 ms
222,964 KB
testcase_17 AC 301 ms
169,888 KB
testcase_18 AC 87 ms
79,904 KB
testcase_19 AC 388 ms
199,444 KB
testcase_20 AC 124 ms
96,168 KB
testcase_21 AC 372 ms
208,004 KB
testcase_22 AC 339 ms
197,052 KB
testcase_23 AC 685 ms
284,088 KB
testcase_24 AC 1,228 ms
369,172 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