結果

問題 No.3716 Keep it Integer
コンテスト
ユーザー 👑 loop0919
提出日時 2026-08-22 00:22:55
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 171 ms / 2,000 ms
+ 331µs
コード長 447 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 74 ms
コンパイル使用メモリ 80,384 KB
実行使用メモリ 107,008 KB
最終ジャッジ日時 2026-09-18 20:50:21
合計ジャッジ時間 9,680 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import defaultdict

MOD = 998244353

N, X = [int(s) for s in input().split()]
A = [int(s) for s in input().split()]

dp = defaultdict(int)
dp[X] = 1

for a in A:
    ndp = defaultdict(int)

    total = sum(dp.values()) % MOD
    ndp[a] += total
    ndp[a] %= MOD

    for key in dp.keys():
        if key % a == 0:
            ndp[key // a] += dp[key]
            ndp[key // a] %= MOD

    dp = ndp

print(sum(dp.values()) % MOD)
0