結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
56,096 KB
testcase_01 AC 39 ms
55,476 KB
testcase_02 AC 471 ms
248,124 KB
testcase_03 AC 85 ms
81,040 KB
testcase_04 AC 296 ms
177,196 KB
testcase_05 AC 116 ms
99,440 KB
testcase_06 AC 303 ms
183,820 KB
testcase_07 AC 107 ms
89,344 KB
testcase_08 AC 207 ms
133,260 KB
testcase_09 AC 278 ms
164,300 KB
testcase_10 AC 355 ms
188,472 KB
testcase_11 AC 96 ms
84,224 KB
testcase_12 AC 279 ms
162,780 KB
testcase_13 AC 136 ms
101,940 KB
testcase_14 AC 246 ms
140,580 KB
testcase_15 AC 415 ms
226,268 KB
testcase_16 AC 403 ms
222,956 KB
testcase_17 AC 310 ms
170,104 KB
testcase_18 AC 90 ms
79,620 KB
testcase_19 AC 395 ms
199,720 KB
testcase_20 AC 123 ms
96,040 KB
testcase_21 AC 380 ms
208,008 KB
testcase_22 AC 348 ms
196,960 KB
testcase_23 AC 707 ms
283,980 KB
testcase_24 AC 1,249 ms
369,028 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 == 1:
      break
    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