結果

問題 No.1973 Divisor Sequence
ユーザー rlangevinrlangevin
提出日時 2022-08-25 22:53:03
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 686 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 81,536 KB
最終ジャッジ日時 2024-04-21 05:18:23
合計ジャッジ時間 10,821 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
59,392 KB
testcase_01 AC 43 ms
53,632 KB
testcase_02 TLE -
testcase_03 AC 109 ms
76,660 KB
testcase_04 AC 1,425 ms
76,624 KB
testcase_05 AC 161 ms
76,672 KB
testcase_06 AC 763 ms
76,288 KB
testcase_07 AC 215 ms
76,544 KB
testcase_08 AC 460 ms
76,544 KB
testcase_09 AC 1,243 ms
76,460 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 #

from collections import defaultdict


def div(n):
    S = set()
    i = 1
    while i * i <= n:
        if n % i == 0:
            S.add(i)
            S.add(n // i)
        i += 1
    return sorted(list(S))

N, M = map(int, input().split())
mod = 10 ** 9 + 7
L = div(M)

pre = defaultdict(int)
lst = defaultdict(list)
for k in L:
    lst[k] = div(M//k)
pre[1] = 1
    
for i in range(N):
    dp = defaultdict(int)
    for k in L:
        c = pre[k] % mod
        for nk in lst[k]:
            if k * nk > M:
                break
            if (M // k) % nk == 0:
                dp[nk] += c 
    pre, dp = dp, pre

ans = 0
for k, v in pre.items():
    ans += v % mod
print(ans % mod)
0