結果
| 問題 | No.2318 Phys Bone Maker |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-27 01:00:19 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,494 bytes |
| 記録 | |
| コンパイル時間 | 305 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 134,784 KB |
| 最終ジャッジ日時 | 2024-12-25 12:30:07 |
| 合計ジャッジ時間 | 35,352 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | AC * 40 TLE * 5 |
ソースコード
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])