結果

問題 No.1973 Divisor Sequence
ユーザー 👑 H20H20
提出日時 2022-06-10 22:02:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 240 ms / 2,000 ms
コード長 706 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 81,708 KB
実行使用メモリ 75,780 KB
最終ジャッジ日時 2023-10-21 06:20:21
合計ジャッジ時間 3,145 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,568 KB
testcase_01 AC 45 ms
55,568 KB
testcase_02 AC 85 ms
75,672 KB
testcase_03 AC 54 ms
68,272 KB
testcase_04 AC 70 ms
75,672 KB
testcase_05 AC 78 ms
75,672 KB
testcase_06 AC 76 ms
75,644 KB
testcase_07 AC 57 ms
72,368 KB
testcase_08 AC 67 ms
75,668 KB
testcase_09 AC 69 ms
75,672 KB
testcase_10 AC 94 ms
75,728 KB
testcase_11 AC 53 ms
68,192 KB
testcase_12 AC 72 ms
75,672 KB
testcase_13 AC 71 ms
75,728 KB
testcase_14 AC 93 ms
75,780 KB
testcase_15 AC 72 ms
75,644 KB
testcase_16 AC 75 ms
75,672 KB
testcase_17 AC 89 ms
75,744 KB
testcase_18 AC 62 ms
73,604 KB
testcase_19 AC 99 ms
75,736 KB
testcase_20 AC 55 ms
70,320 KB
testcase_21 AC 80 ms
75,672 KB
testcase_22 AC 73 ms
75,672 KB
testcase_23 AC 240 ms
75,684 KB
testcase_24 AC 202 ms
75,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections

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


N,M = map(int, input().split())
ans = 1
mod = 10**9+7
CA = collections.Counter(prime_factorize(M))
CACA = collections.Counter()
for k,v in CA.items():
    CACA[v]+=1
for k,v in CACA.items():
    DP = [1]*(k+1)
    for i in range(N-1):
        ACDP = list(DP)
        for j in range(1,k+1):
            ACDP[j]=(ACDP[j]+ACDP[j-1])%mod
        DP = ACDP[::-1]

    ans = pow(sum(DP),v,mod)*ans%mod

print(ans%mod)
0