結果

問題 No.2211 Frequency Table of GCD
ユーザー H20
提出日時 2023-02-10 23:03:27
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 351 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 82,376 KB
実行使用メモリ 97,176 KB
最終ジャッジ日時 2024-07-07 17:05:41
合計ジャッジ時間 5,330 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 TLE * 1 -- * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
import math


N,M = map(int, input().split())
A = list(map(int, input().split()))
mod = 998244353
DP = collections.Counter()
for a in A:
    NDP = collections.Counter()
    for k,v in DP.items():
        gc = math.gcd(k, a)
        NDP[gc]=(NDP[gc]+v)%mod
    NDP[a]+=1
    DP.update(NDP)
for i in range(1,M+1):
    print(DP[i]%mod)
0