結果

問題 No.2313 Product of Subsequence (hard)
ユーザー とりゐとりゐ
提出日時 2023-05-23 22:00:02
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 325 bytes
コンパイル時間 946 ms
コンパイル使用メモリ 85,728 KB
実行使用メモリ 148,576 KB
最終ジャッジ日時 2023-08-25 13:03:35
合計ジャッジ時間 13,165 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
71,780 KB
testcase_01 AC 76 ms
71,844 KB
testcase_02 AC 75 ms
72,072 KB
testcase_03 AC 87 ms
78,256 KB
testcase_04 AC 90 ms
78,236 KB
testcase_05 AC 92 ms
78,120 KB
testcase_06 AC 90 ms
78,312 KB
testcase_07 AC 90 ms
77,976 KB
testcase_08 AC 657 ms
128,880 KB
testcase_09 AC 230 ms
96,188 KB
testcase_10 AC 466 ms
133,340 KB
testcase_11 AC 223 ms
96,308 KB
testcase_12 AC 413 ms
133,424 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())
a=list(map(int,input().split()))
mod=998244353
if k==1:
  print(pow(2,n,mod)-1)
  exit()
import math
from collections import defaultdict
a=[math.gcd(i,k) for i in a]
d=defaultdict(int)
d[1]=1
for i in a:
  d2=d.copy()
  for j in d2:
    m=math.gcd(k,i*j)
    d[m]=(d2[j]+d[m])%mod
print(d[k]%mod)
0