結果

問題 No.1973 Divisor Sequence
ユーザー ああいいああいい
提出日時 2022-06-12 07:44:07
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 831 bytes
コンパイル時間 807 ms
コンパイル使用メモリ 81,640 KB
実行使用メモリ 75,904 KB
最終ジャッジ日時 2023-10-24 00:30:38
合計ジャッジ時間 6,010 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,540 KB
testcase_01 AC 36 ms
53,484 KB
testcase_02 AC 66 ms
68,432 KB
testcase_03 AC 49 ms
60,128 KB
testcase_04 AC 65 ms
66,352 KB
testcase_05 AC 50 ms
59,532 KB
testcase_06 AC 50 ms
62,144 KB
testcase_07 AC 51 ms
59,964 KB
testcase_08 AC 55 ms
62,144 KB
testcase_09 AC 62 ms
66,340 KB
testcase_10 AC 94 ms
75,904 KB
testcase_11 AC 62 ms
68,412 KB
testcase_12 AC 58 ms
62,180 KB
testcase_13 AC 50 ms
62,184 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 #

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

div = []
i = 1
while i * i <= M:
    if M % i == 0:
        div.append(i)
        if i != M // i:
            div.append(M // i)
    i += 1
n = len(div)
R = [[0] * n for _ in range(n)]
for i in range(n):
    p = div[i]
    for j in range(n):
        q = div[j]
        if M % (p * q) == 0:
            R[j][i] += 1
def seki(x,y):
    l = [[0] * n for _ in range(n)]
    for i in range(n):
        for j in range(n):
            for k in range(n):
                l[i][j] += x[i][k] * y[k][j]
            l[i][j] %= P
    return l
e = [[0] * n for _ in range(n)]
for i in range(n):
    e[i][i] = 1
u = N - 1
while u:
    if u & 1:
        e = seki(e,R)
    R = seki(R,R)
    u >>= 1
ans = 0
for i in range(n):
    for j in range(n):
        ans += e[i][j]
        ans %= P
print(ans)
0