結果

問題 No.1731 Product of Subsequence
ユーザー とりゐとりゐ
提出日時 2021-07-29 03:10:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 936 ms / 2,000 ms
コード長 294 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 82,228 KB
実行使用メモリ 79,356 KB
最終ジャッジ日時 2024-04-25 17:07:59
合計ジャッジ時間 10,744 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 769 ms
78,768 KB
testcase_01 AC 41 ms
55,056 KB
testcase_02 AC 41 ms
55,080 KB
testcase_03 AC 41 ms
54,600 KB
testcase_04 AC 41 ms
55,504 KB
testcase_05 AC 46 ms
62,576 KB
testcase_06 AC 48 ms
61,668 KB
testcase_07 AC 41 ms
54,812 KB
testcase_08 AC 66 ms
66,024 KB
testcase_09 AC 40 ms
58,148 KB
testcase_10 AC 936 ms
79,224 KB
testcase_11 AC 803 ms
78,256 KB
testcase_12 AC 54 ms
66,144 KB
testcase_13 AC 78 ms
76,464 KB
testcase_14 AC 687 ms
78,440 KB
testcase_15 AC 41 ms
54,148 KB
testcase_16 AC 36 ms
52,648 KB
testcase_17 AC 40 ms
55,552 KB
testcase_18 AC 642 ms
79,356 KB
testcase_19 AC 80 ms
76,772 KB
testcase_20 AC 514 ms
78,808 KB
testcase_21 AC 909 ms
79,084 KB
testcase_22 AC 57 ms
66,808 KB
testcase_23 AC 40 ms
59,012 KB
testcase_24 AC 65 ms
66,540 KB
testcase_25 AC 56 ms
66,948 KB
testcase_26 AC 204 ms
76,860 KB
testcase_27 AC 252 ms
76,828 KB
testcase_28 AC 455 ms
77,580 KB
testcase_29 AC 216 ms
76,824 KB
testcase_30 AC 763 ms
78,928 KB
testcase_31 AC 56 ms
67,780 KB
testcase_32 AC 41 ms
58,416 KB
testcase_33 AC 55 ms
67,104 KB
testcase_34 AC 124 ms
76,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
a=list(map(int,input().split()))
mod=10**9+7
if k==1:
  print(pow(2,n,mod)-1)
  exit()
import math
from collections import defaultdict
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