結果

問題 No.2318 Phys Bone Maker
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-02-26 03:08:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,609 ms / 3,000 ms
コード長 2,031 bytes
コンパイル時間 414 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 94,192 KB
最終ジャッジ日時 2024-09-18 12:57:57
合計ジャッジ時間 23,905 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
91,844 KB
testcase_01 AC 130 ms
91,776 KB
testcase_02 AC 2,578 ms
94,192 KB
testcase_03 AC 144 ms
91,776 KB
testcase_04 AC 141 ms
91,776 KB
testcase_05 AC 146 ms
92,032 KB
testcase_06 AC 140 ms
92,032 KB
testcase_07 AC 146 ms
92,416 KB
testcase_08 AC 152 ms
92,544 KB
testcase_09 AC 137 ms
91,648 KB
testcase_10 AC 145 ms
92,124 KB
testcase_11 AC 146 ms
91,904 KB
testcase_12 AC 157 ms
92,800 KB
testcase_13 AC 156 ms
92,416 KB
testcase_14 AC 144 ms
91,904 KB
testcase_15 AC 140 ms
91,648 KB
testcase_16 AC 142 ms
91,904 KB
testcase_17 AC 153 ms
91,904 KB
testcase_18 AC 169 ms
92,416 KB
testcase_19 AC 143 ms
91,648 KB
testcase_20 AC 140 ms
91,648 KB
testcase_21 AC 139 ms
91,776 KB
testcase_22 AC 143 ms
92,544 KB
testcase_23 AC 140 ms
91,820 KB
testcase_24 AC 143 ms
91,648 KB
testcase_25 AC 140 ms
92,032 KB
testcase_26 AC 157 ms
92,800 KB
testcase_27 AC 155 ms
91,844 KB
testcase_28 AC 156 ms
91,776 KB
testcase_29 AC 155 ms
92,256 KB
testcase_30 AC 143 ms
91,776 KB
testcase_31 AC 151 ms
92,800 KB
testcase_32 AC 152 ms
91,648 KB
testcase_33 AC 140 ms
91,776 KB
testcase_34 AC 143 ms
91,776 KB
testcase_35 AC 368 ms
93,312 KB
testcase_36 AC 1,357 ms
93,824 KB
testcase_37 AC 1,030 ms
93,952 KB
testcase_38 AC 1,197 ms
93,752 KB
testcase_39 AC 1,899 ms
94,116 KB
testcase_40 AC 1,488 ms
93,968 KB
testcase_41 AC 2,609 ms
94,080 KB
testcase_42 AC 2,125 ms
93,952 KB
testcase_43 AC 157 ms
92,544 KB
testcase_44 AC 302 ms
92,928 KB
testcase_45 AC 281 ms
93,256 KB
testcase_46 AC 1,889 ms
94,080 KB
testcase_47 AC 148 ms
91,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
from math import gcd, log10, pi, sqrt, ceil
from bisect import bisect, bisect_left, bisect_right, insort
from typing import Iterable, TypeVar, Union, Tuple, Iterator, List
import copy
import heapq
import itertools
import math
import random
from fractions import Fraction
from functools import lru_cache, partial, cmp_to_key
import operator
import pypyjit
pypyjit.set_param('max_unroll_recursion=-1')
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
mod = 998244353
INF = 1 << 61
DIFF = 10 ** -9
DX = [1, 0, -1, 0, 1, 1, -1, -1]
DY = [0, 1, 0, -1, 1, -1, 1, -1]

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())

    T = {}
    for n in range(2, int(N ** 0.5) + 1):
        while N % n == 0:
            T[n] = T.get(n, 0) + 1
            N //= n

    if N > 1:
        T[N] = T.get(N, 0) + 1 

    T = list(T.items())
    X = {}
    V = set()

    def f(s, S):
        if len(S) == len(T):
            V.add(s)
            X[s] = (tuple(S))
            return
        
        k, v = T[len(S)] 
        S.append(0)
        for _ in range(v + 1):
            f(s, S)
            s *= k
            S[-1] += 1
        S.pop()
        s //= k ** v
    
    f(1, [])

    N = len(V)
    V = sorted(list(V))
    X = [X[v] for v in V]
    dp = [0] * N
    dp[0] = 1
    for i in range(N):
        for j in range(i + 1, N):
            r = 1
            for ii in range(len(X[i])):
                x1,x2=X[i][ii],X[j][ii]
                if x2 > x1:
                    continue
                elif x2 == x1:
                    r *= x1 + 1
                    r %= mod
                else:
                    break
            else:
                dp[j] += dp[i] * r % mod
                dp[j] %= mod
    
    print(dp[-1])


if __name__ == "__main__":
    main()
0