結果
問題 | No.847 Divisors of Power |
ユーザー |
![]() |
提出日時 | 2019-07-05 22:23:23 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 681 bytes |
コンパイル時間 | 182 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 102,924 KB |
最終ジャッジ日時 | 2024-10-06 22:17:55 |
合計ジャッジ時間 | 7,473 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 RE * 1 |
other | AC * 24 TLE * 2 |
ソースコード
from heapq import * n,k,m=map(int,input().split()) tei=[] sis=[] n0=n cnt=0 while n%2==0: n//=2 cnt+=1 if cnt: tei=[2] sis=[cnt*k] i=3 while i**2<=n: cnt=0 while n%i==0: cnt+=1 n//=i if cnt: tei+=[i] sis+=[cnt*k] i+=2 if n>1: tei+=[n] sis+=[k] kos=len(tei) hp=[] a=[0]*kos heappush(hp,[1]+a) used=set() used.add(tuple(a)) cnt=0 while 1: y,*a=heappop(hp) if y>m:break for i in range(kos): if a[i]==sis[i]:continue ny=y*tei[i] na=a[:] na[i]+=1 ta=tuple(na) if ta in used:continue heappush(hp,[ny]+na) used.add(ta) cnt+=1 print(cnt)