結果

問題 No.1973 Divisor Sequence
ユーザー rlangevinrlangevin
提出日時 2022-08-25 22:56:54
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 670 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 82,784 KB
実行使用メモリ 85,268 KB
最終ジャッジ日時 2024-04-21 05:21:22
合計ジャッジ時間 10,938 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
59,008 KB
testcase_01 AC 41 ms
54,016 KB
testcase_02 AC 1,373 ms
76,416 KB
testcase_03 AC 90 ms
76,452 KB
testcase_04 AC 814 ms
76,336 KB
testcase_05 AC 129 ms
76,368 KB
testcase_06 AC 513 ms
76,160 KB
testcase_07 AC 150 ms
76,288 KB
testcase_08 AC 334 ms
76,172 KB
testcase_09 AC 715 ms
76,544 KB
testcase_10 AC 1,936 ms
77,056 KB
testcase_11 AC 182 ms
76,288 KB
testcase_12 AC 415 ms
76,416 KB
testcase_13 AC 251 ms
76,416 KB
testcase_14 TLE -
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:
    for nk in L:
        if (M // k) % nk == 0:
            lst[nk].append(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]:
            dp[nk] += c 
                
    pre, dp = dp, pre

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