結果

問題 No.2313 Product of Subsequence (hard)
ユーザー prussian_coderprussian_coder
提出日時 2023-05-24 21:14:53
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 348 bytes
コンパイル時間 766 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 130,908 KB
最終ジャッジ日時 2023-08-25 13:27:53
合計ジャッジ時間 9,753 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
75,500 KB
testcase_01 AC 70 ms
71,072 KB
testcase_02 AC 71 ms
71,364 KB
testcase_03 AC 85 ms
76,800 KB
testcase_04 AC 89 ms
76,868 KB
testcase_05 AC 85 ms
77,008 KB
testcase_06 AC 83 ms
76,796 KB
testcase_07 AC 82 ms
76,860 KB
testcase_08 AC 345 ms
116,816 KB
testcase_09 AC 203 ms
94,204 KB
testcase_10 AC 346 ms
120,568 KB
testcase_11 AC 189 ms
91,536 KB
testcase_12 AC 339 ms
121,620 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 #

N,K=map(int,input().split())
import math
B=[int(x) for x in input().split()]
A=sorted([math.gcd(a,K) for a in B])

mod=998244353

dp=dict()
dp[1]=1
dp2=dp.copy()
for i in range(N):
	a=A[i]
	for k in dp:
		p = k * math.gcd(K//k,a)
		if not p in dp2:
			dp2[p]=0
		dp2[p]+=dp[k]
		dp2[p]%=mod
	dp=dp2.copy()
if K in dp:
	print(dp[K])
else:
	print(0)
0