結果

問題 No.2318 Phys Bone Maker
ユーザー flygonflygon
提出日時 2023-05-26 22:24:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 936 ms / 3,000 ms
コード長 1,423 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 87,252 KB
実行使用メモリ 80,592 KB
最終ジャッジ日時 2023-08-26 12:25:05
合計ジャッジ時間 14,574 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
72,180 KB
testcase_01 AC 98 ms
72,036 KB
testcase_02 AC 929 ms
80,140 KB
testcase_03 AC 116 ms
76,988 KB
testcase_04 AC 122 ms
76,980 KB
testcase_05 AC 118 ms
76,848 KB
testcase_06 AC 117 ms
76,724 KB
testcase_07 AC 112 ms
78,428 KB
testcase_08 AC 126 ms
78,152 KB
testcase_09 AC 113 ms
76,852 KB
testcase_10 AC 132 ms
76,580 KB
testcase_11 AC 121 ms
76,704 KB
testcase_12 AC 142 ms
78,196 KB
testcase_13 AC 144 ms
78,088 KB
testcase_14 AC 124 ms
76,888 KB
testcase_15 AC 122 ms
76,824 KB
testcase_16 AC 122 ms
76,940 KB
testcase_17 AC 129 ms
76,868 KB
testcase_18 AC 141 ms
77,840 KB
testcase_19 AC 110 ms
76,828 KB
testcase_20 AC 121 ms
76,700 KB
testcase_21 AC 117 ms
76,936 KB
testcase_22 AC 116 ms
77,036 KB
testcase_23 AC 117 ms
77,204 KB
testcase_24 AC 129 ms
76,580 KB
testcase_25 AC 125 ms
76,872 KB
testcase_26 AC 132 ms
77,740 KB
testcase_27 AC 126 ms
76,988 KB
testcase_28 AC 117 ms
76,872 KB
testcase_29 AC 116 ms
76,916 KB
testcase_30 AC 114 ms
76,576 KB
testcase_31 AC 133 ms
77,036 KB
testcase_32 AC 125 ms
76,844 KB
testcase_33 AC 97 ms
71,888 KB
testcase_34 AC 130 ms
76,664 KB
testcase_35 AC 231 ms
79,488 KB
testcase_36 AC 583 ms
80,220 KB
testcase_37 AC 519 ms
79,552 KB
testcase_38 AC 525 ms
80,232 KB
testcase_39 AC 708 ms
80,216 KB
testcase_40 AC 725 ms
80,080 KB
testcase_41 AC 918 ms
80,592 KB
testcase_42 AC 789 ms
79,944 KB
testcase_43 AC 156 ms
78,292 KB
testcase_44 AC 233 ms
79,664 KB
testcase_45 AC 242 ms
79,300 KB
testcase_46 AC 936 ms
80,420 KB
testcase_47 AC 131 ms
76,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

n = int(input())
mod = 998244353

def fact(n):
    l = set()
    for i in range(1,int(pow(n,0.5))+1):
        if n % i == 0:
            l.add(i)
            l.add(n//i)
    return sorted(list(l))

def pfact(n):
    l = []
    tmp = n
    for i in range(2,int(pow(n,0.5))+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            l.append([i,cnt])
    if tmp != 1:
        l.append([tmp,1])
    return l

fn = fact(n)
pp = [i for i,j in pfact(n)]
d = [[0]*(len(pp)) for i in range(len(fn))]
for i in range(len(fn)):
    now = fn[i]
    for j in range(len(pp)):
        while now % pp[j] == 0:
            d[i][j] += 1
            now //= pp[j]

cnt = defaultdict(int)
for i in range(len(fn)):
    tmp = 1
    for j in range(len(pp)):
        tmp *= d[i][j] + 1
    cnt[fn[i]] = tmp

dp = [1]*(len(fn))
for i in range(1,len(fn)):
    for j in range(i+1,len(fn)):
        if fn[j] % fn[i] != 0: continue
        tmp = fn[j] // fn[i]
        tmp = 1
        for k in range(len(pp)):
            if d[i][k] == d[j][k]:
                tmp *= d[i][k] + 1
        dp[j] += dp[i] * tmp
        dp[j] %= mod
print(dp[-1])
0