結果

問題 No.2318 Phys Bone Maker
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-02-21 22:11:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,145 ms / 3,000 ms
コード長 1,517 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 81,840 KB
実行使用メモリ 75,844 KB
最終ジャッジ日時 2023-10-18 16:54:04
合計ジャッジ時間 11,463 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,536 KB
testcase_01 AC 36 ms
53,536 KB
testcase_02 AC 1,145 ms
75,832 KB
testcase_03 AC 48 ms
62,184 KB
testcase_04 AC 42 ms
59,384 KB
testcase_05 AC 41 ms
59,384 KB
testcase_06 AC 41 ms
59,384 KB
testcase_07 AC 57 ms
66,416 KB
testcase_08 AC 59 ms
68,472 KB
testcase_09 AC 42 ms
59,384 KB
testcase_10 AC 43 ms
59,384 KB
testcase_11 AC 48 ms
61,808 KB
testcase_12 AC 60 ms
68,476 KB
testcase_13 AC 66 ms
75,556 KB
testcase_14 AC 42 ms
59,384 KB
testcase_15 AC 43 ms
59,384 KB
testcase_16 AC 45 ms
59,384 KB
testcase_17 AC 47 ms
61,724 KB
testcase_18 AC 59 ms
68,472 KB
testcase_19 AC 41 ms
59,384 KB
testcase_20 AC 42 ms
59,384 KB
testcase_21 AC 41 ms
59,384 KB
testcase_22 AC 45 ms
61,460 KB
testcase_23 AC 43 ms
59,384 KB
testcase_24 AC 42 ms
59,384 KB
testcase_25 AC 44 ms
59,384 KB
testcase_26 AC 58 ms
68,472 KB
testcase_27 AC 44 ms
59,520 KB
testcase_28 AC 42 ms
59,384 KB
testcase_29 AC 41 ms
59,384 KB
testcase_30 AC 45 ms
59,384 KB
testcase_31 AC 46 ms
61,596 KB
testcase_32 AC 47 ms
59,384 KB
testcase_33 AC 37 ms
53,544 KB
testcase_34 AC 45 ms
61,776 KB
testcase_35 AC 194 ms
75,656 KB
testcase_36 AC 555 ms
75,788 KB
testcase_37 AC 598 ms
75,792 KB
testcase_38 AC 620 ms
75,808 KB
testcase_39 AC 797 ms
75,772 KB
testcase_40 AC 850 ms
75,820 KB
testcase_41 AC 907 ms
75,792 KB
testcase_42 AC 964 ms
75,828 KB
testcase_43 AC 69 ms
75,596 KB
testcase_44 AC 273 ms
75,720 KB
testcase_45 AC 261 ms
75,716 KB
testcase_46 AC 1,039 ms
75,844 KB
testcase_47 AC 54 ms
59,384 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())
    c=dict()
    while(n > 1):
        find = False
        v = 2
        while v*v<=n:
            if n%v==0:
                find=True
                c[v]=c.get(v,0)+1
                n//=v
                break
            v+=1
        if find==False:
            c[n]=c.get(n,0)+1
            break
    a=list(c.values())
    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)
        while ar2[-1]==0:
            if ar != ar2:
                add = dp[getind(ar)]
                for i in range(sa):
                    if ar[i]==ar2[i]:
                        add*=ar[i]+1
                dp[getind(ar2)]=(dp[getind(ar2)]+add)%998244353
            ar2[0]+=1
            for i in range(sa):
                if ar2[i]>a[i]:
                    ar2[i]=ar[i]
                    ar2[i+1]+=1
        ar[0]+=1
        for i in range(sa):
            if ar[i]>a[i]:
                ar[i]=0
                ar[i+1]+=1
    a.append(0)
    print(dp[-1])
        
if __name__ == "__main__":
    main()
0