結果

問題 No.2318 Phys Bone Maker
ユーザー mkawa2mkawa2
提出日時 2023-05-26 22:02:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,658 ms / 3,000 ms
コード長 1,776 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 79,756 KB
最終ジャッジ日時 2023-08-26 11:36:39
合計ジャッジ時間 16,602 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,288 KB
testcase_01 AC 74 ms
71,200 KB
testcase_02 AC 1,658 ms
79,604 KB
testcase_03 AC 79 ms
76,020 KB
testcase_04 AC 77 ms
75,336 KB
testcase_05 AC 76 ms
75,464 KB
testcase_06 AC 75 ms
75,352 KB
testcase_07 AC 86 ms
76,332 KB
testcase_08 AC 85 ms
76,292 KB
testcase_09 AC 76 ms
75,168 KB
testcase_10 AC 75 ms
75,312 KB
testcase_11 AC 81 ms
76,416 KB
testcase_12 AC 87 ms
76,180 KB
testcase_13 AC 90 ms
76,392 KB
testcase_14 AC 76 ms
75,488 KB
testcase_15 AC 75 ms
75,196 KB
testcase_16 AC 76 ms
75,360 KB
testcase_17 AC 80 ms
76,176 KB
testcase_18 AC 88 ms
76,176 KB
testcase_19 AC 74 ms
75,220 KB
testcase_20 AC 76 ms
75,280 KB
testcase_21 AC 75 ms
75,368 KB
testcase_22 AC 82 ms
76,204 KB
testcase_23 AC 77 ms
75,464 KB
testcase_24 AC 79 ms
75,192 KB
testcase_25 AC 77 ms
75,300 KB
testcase_26 AC 88 ms
76,252 KB
testcase_27 AC 79 ms
75,232 KB
testcase_28 AC 79 ms
75,560 KB
testcase_29 AC 78 ms
75,180 KB
testcase_30 AC 79 ms
75,232 KB
testcase_31 AC 81 ms
75,812 KB
testcase_32 AC 84 ms
75,324 KB
testcase_33 AC 74 ms
71,188 KB
testcase_34 AC 73 ms
70,880 KB
testcase_35 AC 286 ms
78,584 KB
testcase_36 AC 935 ms
79,312 KB
testcase_37 AC 870 ms
78,984 KB
testcase_38 AC 820 ms
78,804 KB
testcase_39 AC 1,382 ms
79,736 KB
testcase_40 AC 1,247 ms
79,508 KB
testcase_41 AC 1,523 ms
79,720 KB
testcase_42 AC 1,390 ms
79,756 KB
testcase_43 AC 89 ms
76,348 KB
testcase_44 AC 200 ms
77,896 KB
testcase_45 AC 191 ms
77,972 KB
testcase_46 AC 1,237 ms
79,240 KB
testcase_47 AC 85 ms
75,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
# sys.set_int_max_str_digits(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# md = 10**9+7
md = 998244353

def prime_factorization(a):
    pp, ee = [], []
    if a & 1 == 0:
        pp += [2]
        ee += [0]
        while a & 1 == 0:
            a >>= 1
            ee[-1] += 1
    p = 3
    while p**2 <= a:
        if a%p == 0:
            pp += [p]
            ee += [0]
            while a%p == 0:
                a //= p
                ee[-1] += 1
        p += 2
    if a > 1:
        pp += [a]
        ee += [1]
    return pp, ee

n=II()
pp,ee=prime_factorization(n)

ss=[]
def dfs(i,arr):
    if i==len(pp):
        ss.append(arr)
        return
    for e in range(ee[i]+1):
        dfs(i+1,arr+[e])

dfs(0,[])

ia=[]
for i,s in enumerate(ss):
    a=1
    for p,e in zip(pp,s):a*=p**e
    ia.append((i,a))

ia.sort(key=lambda x:x[1])
dp=[0]*len(ia)
dp[0]=1
for i,a in ia:
    for j in range(i):
        c=1
        for e,f in zip(ss[j],ss[i]):
            if e>f:
                c=0
                break
            if e==f:
                c*=e+1
                c%=md
        dp[i]+=dp[j]*c%md
        dp[i]%=md

print(dp[-1])
0