結果
| 問題 |
No.2318 Phys Bone Maker
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-27 01:12:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,329 bytes |
| コンパイル時間 | 370 ms |
| コンパイル使用メモリ | 82,252 KB |
| 実行使用メモリ | 80,044 KB |
| 最終ジャッジ日時 | 2024-12-25 12:43:12 |
| 合計ジャッジ時間 | 31,771 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | AC * 42 TLE * 3 |
ソースコード
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 = dict()
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[i]=cnt
if temp!=1:
arr[temp]=1
if len(arr)==0:
arr[n]=1
return arr
MOD = 998244353
N = int(input())
Y = make_divisors(N)
F = []
for y in Y:
F.append(factorization(y))
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=temp*(ej+1)%MOD
if temp==0:
continue
dp[j] = (dp[j]+temp)%MOD
print(dp[-1])