結果
| 問題 | No.2576 LCM Pattern |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-12-04 16:57:57 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 95 ms / 2,000 ms |
| + 588µs | |
| コード長 | 574 bytes |
| 記録 | |
| コンパイル時間 | 231 ms |
| コンパイル使用メモリ | 96,076 KB |
| 実行使用メモリ | 85,148 KB |
| 最終ジャッジ日時 | 2026-09-05 02:25:55 |
| 合計ジャッジ時間 | 3,483 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
from collections import defaultdict
MOD=998244353
N,M=map(int,input().split())
use=set()
for i in range(1,M+1):
if M%i==0:
use.add(i)
use.add(M//i)
if i*i>M:
break
use=sorted(list(use),reverse=True)
count=defaultdict(int)
count[M]=1
ans=0
for i in use:
now=set()
for j in range(1,i+1):
if i%j==0:
now.add(j)
now.add(i//j)
if j*j>i:
break
ans+=count[i]*pow(len(now),N,MOD)
ans%=MOD
for j in now:
if j==i:
continue
count[j]-=count[i]
print(ans)