結果

問題 No.1973 Divisor Sequence
ユーザー terasaterasa
提出日時 2022-06-10 22:49:15
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,461 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 81,864 KB
実行使用メモリ 173,364 KB
最終ジャッジ日時 2023-10-21 05:34:08
合計ジャッジ時間 8,614 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
60,136 KB
testcase_01 AC 40 ms
55,788 KB
testcase_02 AC 750 ms
173,364 KB
testcase_03 AC 95 ms
80,416 KB
testcase_04 AC 492 ms
132,860 KB
testcase_05 AC 179 ms
97,736 KB
testcase_06 AC 351 ms
130,412 KB
testcase_07 AC 150 ms
85,160 KB
testcase_08 AC 251 ms
104,620 KB
testcase_09 AC 441 ms
125,488 KB
testcase_10 AC 1,193 ms
157,708 KB
testcase_11 AC 139 ms
84,008 KB
testcase_12 AC 325 ms
119,544 KB
testcase_13 AC 174 ms
91,492 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 #

import sys
import pypyjit
import itertools
import heapq
import math
from collections import deque, defaultdict
import bisect

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
pypyjit.set_param('max_unroll_recursion=-1')


def index_lt(a, x):
    'return largest index s.t. A[i] < x or -1 if it does not exist'
    return bisect.bisect_left(a, x) - 1


def index_le(a, x):
    'return largest index s.t. A[i] <= x or -1 if it does not exist'
    return bisect.bisect_right(a, x) - 1


def index_gt(a, x):
    'return smallest index s.t. A[i] > x or len(a) if it does not exist'
    return bisect.bisect_right(a, x)


def index_ge(a, x):
    'return smallest index s.t. A[i] >= x or len(a) if it does not exist'
    return bisect.bisect_left(a, x)


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


def divs(n):
    d = []
    for i in range(1, n + 1):
        if i * i > n:
            break
        if i * i == n:
            d.append(i)
            break
        if n % i == 0:
            d.append(i)
            d.append(n // i)
    return sorted(d)


D = divs(M)
idx = {}
for i, n in enumerate(D):
    idx[n] = i
ds = []
for d in D:
    ds.append([idx[n] for n in divs(M // d)])

dp = [[0 for _ in range(len(D))] for _ in range(N + 1)]
for j in range(len(D)):
    dp[1][j] = 1
for i in range(1, N):
    for j in range(len(D)):
        for k in ds[j]:
            dp[i + 1][k] += dp[i][j]
            dp[i + 1][k] %= mod
print(sum(dp[N]) % mod)
0