結果

問題 No.2318 Phys Bone Maker
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-02-22 09:31:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 716 ms / 3,000 ms
コード長 1,486 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 81,812 KB
実行使用メモリ 76,264 KB
最終ジャッジ日時 2023-10-18 16:54:47
合計ジャッジ時間 8,548 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,580 KB
testcase_01 AC 37 ms
53,580 KB
testcase_02 AC 716 ms
76,156 KB
testcase_03 AC 42 ms
59,436 KB
testcase_04 AC 41 ms
59,428 KB
testcase_05 AC 40 ms
59,428 KB
testcase_06 AC 40 ms
59,428 KB
testcase_07 AC 51 ms
64,280 KB
testcase_08 AC 54 ms
66,588 KB
testcase_09 AC 41 ms
59,428 KB
testcase_10 AC 41 ms
59,428 KB
testcase_11 AC 44 ms
59,504 KB
testcase_12 AC 52 ms
64,520 KB
testcase_13 AC 61 ms
70,568 KB
testcase_14 AC 41 ms
59,428 KB
testcase_15 AC 40 ms
59,428 KB
testcase_16 AC 44 ms
59,428 KB
testcase_17 AC 42 ms
59,436 KB
testcase_18 AC 55 ms
66,588 KB
testcase_19 AC 41 ms
59,428 KB
testcase_20 AC 40 ms
59,428 KB
testcase_21 AC 41 ms
59,428 KB
testcase_22 AC 41 ms
58,912 KB
testcase_23 AC 42 ms
59,428 KB
testcase_24 AC 40 ms
59,428 KB
testcase_25 AC 43 ms
59,428 KB
testcase_26 AC 51 ms
64,352 KB
testcase_27 AC 41 ms
59,428 KB
testcase_28 AC 40 ms
59,428 KB
testcase_29 AC 40 ms
59,428 KB
testcase_30 AC 43 ms
59,428 KB
testcase_31 AC 42 ms
59,436 KB
testcase_32 AC 47 ms
59,428 KB
testcase_33 AC 37 ms
53,580 KB
testcase_34 AC 40 ms
55,628 KB
testcase_35 AC 150 ms
75,952 KB
testcase_36 AC 394 ms
76,052 KB
testcase_37 AC 399 ms
76,264 KB
testcase_38 AC 418 ms
76,004 KB
testcase_39 AC 543 ms
76,264 KB
testcase_40 AC 553 ms
76,260 KB
testcase_41 AC 593 ms
76,096 KB
testcase_42 AC 608 ms
76,060 KB
testcase_43 AC 69 ms
76,024 KB
testcase_44 AC 166 ms
75,752 KB
testcase_45 AC 161 ms
76,232 KB
testcase_46 AC 645 ms
76,116 KB
testcase_47 AC 56 ms
59,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for _ in range(N)]
            
def main():
    n=int(input())
    a=list()
    v = 2
    while v*v<=n:
        if n%v:
            v+=1
            continue
        a.append(0)
        while n%v==0:
            a[-1]+=1
            n//=v
        v+=1
    if n>1:a.append(1)
    sa=len(a)
    a.append(0)
    def getind(ar):
        res=0
        for i in range(sa):
            res*=a[i]+1
            res+=ar[i]
        return res
    cn = getind(a)+1
    dp = [0]*cn
    ar=[0]*(sa+1)
    dp[0]=1
    while ar[-1]==0:
        ar2=list(ar)
        ind=getind(ar)
        while ar2[-1]==0:
            if ar != ar2:
                ind2=getind(ar2)
                add = dp[ind]
                for i in range(sa):
                    if ar[i]==ar2[i]:
                        add*=ar[i]+1
                dp[ind2]=(dp[ind2]+add)%998244353
            ar2[0]+=1
            for i in range(sa):
                if ar2[i]>a[i]:
                    ar2[i]=ar[i]
                    ar2[i+1]+=1
                else:break
        ar[0]+=1
        for i in range(sa):
            if ar[i]>a[i]:
                ar[i]=0
                ar[i+1]+=1
            else:break
    a.append(0)
    print(dp[-1])
        
if __name__ == "__main__":
    main()
0