結果
問題 |
No.2318 Phys Bone Maker
|
ユーザー |
|
提出日時 | 2023-05-26 23:03:23 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 612 bytes |
コンパイル時間 | 161 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 271,876 KB |
最終ジャッジ日時 | 2024-12-25 10:11:07 |
合計ジャッジ時間 | 52,998 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 TLE * 1 |
other | AC * 7 WA * 27 TLE * 11 |
ソースコード
from collections import defaultdict,deque import math import heapq mod=998244353 n=int(input()) S=set() i=1 while i*i<=n: if n%i==0: S.add(i) S.add(n//i) i+=1 LS=sorted(S) d=defaultdict(int) d[(1,1)]=1 ans=0 #q=deque([(1,1)]) heap=[] heapq.heappush(heap,(1,1)) H=set() while heap: # print(heap) xi,ai=heapq.heappop(heap) for e in LS: tmp=ai*e//math.gcd(ai,e) if xi<tmp: if tmp==n: ans+=d[(xi,ai)] ans%=mod else: if (tmp,e) not in S: S.add((tmp,e)) heapq.heappush(heap,(tmp,e)) d[(tmp,e)]+=d[(xi,ai)] # print(d) print(ans)