結果

問題 No.1731 Product of Subsequence
ユーザー irumo8202irumo8202
提出日時 2022-01-29 13:15:40
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 270 bytes
コンパイル時間 723 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 90,780 KB
最終ジャッジ日時 2023-08-30 10:56:20
合計ジャッジ時間 14,353 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 881 ms
86,800 KB
testcase_01 AC 72 ms
71,432 KB
testcase_02 AC 73 ms
71,684 KB
testcase_03 RE -
testcase_04 AC 72 ms
71,700 KB
testcase_05 AC 78 ms
76,668 KB
testcase_06 AC 79 ms
76,532 KB
testcase_07 RE -
testcase_08 AC 102 ms
76,596 KB
testcase_09 AC 79 ms
76,768 KB
testcase_10 AC 1,054 ms
90,188 KB
testcase_11 AC 911 ms
87,080 KB
testcase_12 RE -
testcase_13 AC 115 ms
77,280 KB
testcase_14 AC 840 ms
85,492 KB
testcase_15 RE -
testcase_16 AC 73 ms
71,324 KB
testcase_17 AC 73 ms
71,320 KB
testcase_18 AC 664 ms
81,100 KB
testcase_19 AC 129 ms
77,988 KB
testcase_20 AC 559 ms
79,924 KB
testcase_21 AC 1,067 ms
90,780 KB
testcase_22 AC 83 ms
76,976 KB
testcase_23 AC 82 ms
76,788 KB
testcase_24 AC 103 ms
77,560 KB
testcase_25 AC 89 ms
77,096 KB
testcase_26 AC 274 ms
78,076 KB
testcase_27 AC 334 ms
78,900 KB
testcase_28 AC 551 ms
80,460 KB
testcase_29 AC 291 ms
78,428 KB
testcase_30 AC 905 ms
87,844 KB
testcase_31 AC 85 ms
76,620 KB
testcase_32 AC 83 ms
76,800 KB
testcase_33 AC 86 ms
76,840 KB
testcase_34 AC 181 ms
78,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

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

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

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