結果

問題 No.2318 Phys Bone Maker
ユーザー miya145592miya145592
提出日時 2023-05-27 01:00:19
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,494 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 87,392 KB
実行使用メモリ 82,372 KB
最終ジャッジ日時 2023-08-26 14:45:45
合計ジャッジ時間 34,552 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
72,324 KB
testcase_01 AC 90 ms
71,968 KB
testcase_02 TLE -
testcase_03 AC 122 ms
77,156 KB
testcase_04 AC 131 ms
77,312 KB
testcase_05 AC 117 ms
77,004 KB
testcase_06 AC 120 ms
77,296 KB
testcase_07 AC 117 ms
78,092 KB
testcase_08 AC 154 ms
78,200 KB
testcase_09 AC 123 ms
77,164 KB
testcase_10 AC 151 ms
77,220 KB
testcase_11 AC 169 ms
77,160 KB
testcase_12 AC 230 ms
78,084 KB
testcase_13 AC 229 ms
79,024 KB
testcase_14 AC 137 ms
77,136 KB
testcase_15 AC 135 ms
77,240 KB
testcase_16 AC 121 ms
77,164 KB
testcase_17 AC 147 ms
77,356 KB
testcase_18 AC 218 ms
78,264 KB
testcase_19 AC 113 ms
76,900 KB
testcase_20 AC 126 ms
77,052 KB
testcase_21 AC 117 ms
76,888 KB
testcase_22 AC 121 ms
77,220 KB
testcase_23 AC 118 ms
77,220 KB
testcase_24 AC 142 ms
77,092 KB
testcase_25 AC 147 ms
77,200 KB
testcase_26 AC 163 ms
78,156 KB
testcase_27 AC 131 ms
77,224 KB
testcase_28 AC 115 ms
77,384 KB
testcase_29 AC 112 ms
77,064 KB
testcase_30 AC 110 ms
77,060 KB
testcase_31 AC 167 ms
77,316 KB
testcase_32 AC 128 ms
77,420 KB
testcase_33 AC 92 ms
71,976 KB
testcase_34 AC 149 ms
77,128 KB
testcase_35 AC 495 ms
79,824 KB
testcase_36 AC 1,867 ms
81,992 KB
testcase_37 AC 1,831 ms
81,560 KB
testcase_38 AC 1,906 ms
81,680 KB
testcase_39 AC 2,827 ms
81,836 KB
testcase_40 AC 2,857 ms
82,120 KB
testcase_41 TLE -
testcase_42 TLE -
testcase_43 AC 226 ms
78,344 KB
testcase_44 AC 731 ms
79,852 KB
testcase_45 AC 680 ms
79,784 KB
testcase_46 TLE -
testcase_47 AC 129 ms
77,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import math

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

MOD = 998244353
N = int(input())
Y = make_divisors(N)
F = []
for y in Y:
    f = factorization(y)
    d = dict()
    for p, e in f:
        d[p] = e
    F.append(d)
dp = [0 for _ in range(len(Y))]
dp[0] = 1
for i in range(len((Y))):
    for j in range(i+1, len(Y)):
        #Y[i] -> Y[j]
        temp = dp[i]
        for p in F[i]:
            if p==1:
                continue
            if p not in F[j]:
                temp*=0
                break
            else:
                ej = F[j][p]
                ei = F[i][p]
                if ei>ej:
                    temp*=0
                    break
                elif ei==ej:
                    temp*=(ej+1)
                    temp%=MOD
                else:
                    temp*=1
        dp[j] = (dp[j]+temp)%MOD
print(dp[-1])
0