結果
問題 |
No.2896 Monotonic Prime Factors
|
ユーザー |
![]() |
提出日時 | 2024-09-28 00:49:50 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 671 bytes |
コンパイル時間 | 257 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 266,112 KB |
最終ジャッジ日時 | 2024-09-28 00:49:57 |
合計ジャッジ時間 | 5,732 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 2 TLE * 1 -- * 15 |
ソースコード
from collections import defaultdict def prime_divisors(x): P=[] for p in range(2,int(x**0.5)+1): while x%p==0: P.append(p) x//=p if x>1: P.append(x) return P MOD=998244353 fact=[1]*(10**6+1) for i in range(10**6): fact[i+1]=fact[i]*(i+1)%MOD ifact=[1]*(10**6+1) ifact[10**6]=pow(fact[10**6],MOD-2,MOD) for i in range(10**6,0,-1): ifact[i-1]=ifact[i]*i%MOD def nCr(n,r): if n<r:return 0 return fact[n]*ifact[n-r]*ifact[r]%MOD q=int(input()) ab=[list(map(int,input().split())) for _ in range(q)] prime_cnt=0 x=1 for a,b in ab: x*=a prime_cnt+=len(prime_divisors(a)) ans=nCr(prime_cnt-b+b-1,b-1) print(ans)