結果

問題 No.2313 Product of Subsequence (hard)
ユーザー convexineqconvexineq
提出日時 2023-05-25 10:51:05
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 414 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 87,016 KB
実行使用メモリ 139,360 KB
最終ジャッジ日時 2023-08-25 19:22:23
合計ジャッジ時間 13,339 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,840 KB
testcase_01 AC 88 ms
71,472 KB
testcase_02 AC 90 ms
71,740 KB
testcase_03 AC 124 ms
78,088 KB
testcase_04 AC 106 ms
77,748 KB
testcase_05 AC 109 ms
78,188 KB
testcase_06 AC 111 ms
77,992 KB
testcase_07 AC 107 ms
77,960 KB
testcase_08 AC 787 ms
135,960 KB
testcase_09 AC 254 ms
100,740 KB
testcase_10 AC 555 ms
132,692 KB
testcase_11 AC 244 ms
95,352 KB
testcase_12 AC 476 ms
139,360 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline = sys.stdin.readline

n,k = map(int,readline().split())
*a, = map(int,readline().split())

MOD = 998244353

from math import gcd
for i in range(n):
    a[i] = gcd(a[i],k)

from collections import defaultdict
d = defaultdict(int)
d[1] = 1
for ai in a:
    nd = d.copy()
    for r,v in d.items():
        nr = gcd(ai*r,k)
        nd[nr] += v
        nd[nr] %= MOD
    d = nd

print(d[k])








0