結果

問題 No.3716 Keep it Integer
コンテスト
ユーザー 回転
提出日時 2026-09-18 21:45:43
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 169 ms / 2,000 ms
+ 811µs
コード長 607 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 75 ms
コンパイル使用メモリ 81,024 KB
実行使用メモリ 116,976 KB
最終ジャッジ日時 2026-09-18 21:45:57
合計ジャッジ時間 8,926 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def main():
    from collections import defaultdict
    import sys
    input = sys.stdin.readline
    MOD = 998244353
    N, X = list(map(int, input().split()))
    A = list(map(int, input().split()))

    dp = defaultdict(int);dp[X] = 1
    for i in range(N):
        next = defaultdict(int)
        for j in dp:
            next[A[i]] += dp[j]
            if(next[A[i]] > MOD):next[A[i]] -= MOD
            if(j % A[i] == 0):
                v = j // A[i]
                next[v] += dp[j]
                if(next[v] > MOD):next[v] -= MOD
        dp,next = next,dp
    print(sum(dp.values()) % MOD)

main()
0