結果

問題 No.1973 Divisor Sequence
ユーザー ntudantuda
提出日時 2022-07-03 15:34:04
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 755 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 113,536 KB
最終ジャッジ日時 2024-05-06 22:29:30
合計ジャッジ時間 4,134 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
59,520 KB
testcase_01 AC 44 ms
53,376 KB
testcase_02 TLE -
testcase_03 AC 83 ms
76,032 KB
testcase_04 AC 716 ms
83,840 KB
testcase_05 AC 611 ms
80,896 KB
testcase_06 AC 1,508 ms
97,408 KB
testcase_07 AC 123 ms
76,032 KB
testcase_08 AC 452 ms
79,104 KB
testcase_09 AC 571 ms
81,024 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
MOD = 10 ** 9 + 7

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def n_fact(N):
    c = collections.Counter(prime_factorize(N))
    return c

N, M = map(int, input().split())
X = n_fact(M)
x2 = collections.Counter(X.values())

ans = 1
for k, v in x2.items():
    dp = [1] * (k + 1)
    for i in range(N-1):
        dp2 = [1] * (k+1)
        sump = 0
        for j in range(k+1):
            sump += dp[j]
            dp2[k-j] = sump
        dp = dp2
    ans *= pow(sum(dp),v,MOD)
    ans %= MOD

print(ans)

0