結果

問題 No.1731 Product of Subsequence
ユーザー irumo8202irumo8202
提出日時 2022-01-29 13:05:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 267 bytes
コンパイル時間 626 ms
コンパイル使用メモリ 10,720 KB
実行使用メモリ 8,996 KB
最終ジャッジ日時 2023-08-30 10:42:43
合計ジャッジ時間 21,865 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 RE -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 RE -
testcase_08 WA -
testcase_09 AC 18 ms
8,488 KB
testcase_10 TLE -
testcase_11 WA -
testcase_12 RE -
testcase_13 WA -
testcase_14 WA -
testcase_15 RE -
testcase_16 AC 17 ms
7,900 KB
testcase_17 AC 16 ms
7,900 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 TLE -
testcase_22 WA -
testcase_23 AC 18 ms
8,448 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 TLE -
testcase_31 WA -
testcase_32 AC 18 ms
7,916 KB
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

N, K, *A = map(int, open(0).read().split())
M = 1000000007

dp = {1: 1}
for a in A:
    for n in dp.copy():
        g = math.gcd(a * n, K)
        if g in dp:
            dp[g] += dp[n]
        else:
            dp[g] = dp[n]

print(dp[K] % M - (K == 1))
0