結果

問題 No.1731 Product of Subsequence
ユーザー ygd.ygd.
提出日時 2021-11-07 16:30:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 566 bytes
コンパイル時間 366 ms
コンパイル使用メモリ 82,348 KB
実行使用メモリ 82,652 KB
最終ジャッジ日時 2024-04-26 14:37:32
合計ジャッジ時間 11,716 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 866 ms
81,036 KB
testcase_01 AC 45 ms
61,796 KB
testcase_02 AC 46 ms
60,872 KB
testcase_03 AC 47 ms
60,864 KB
testcase_04 AC 45 ms
61,336 KB
testcase_05 AC 50 ms
62,968 KB
testcase_06 AC 51 ms
64,056 KB
testcase_07 AC 45 ms
60,588 KB
testcase_08 AC 73 ms
70,060 KB
testcase_09 WA -
testcase_10 AC 1,056 ms
81,436 KB
testcase_11 AC 891 ms
80,356 KB
testcase_12 AC 59 ms
68,096 KB
testcase_13 AC 85 ms
77,016 KB
testcase_14 AC 761 ms
80,000 KB
testcase_15 AC 45 ms
60,160 KB
testcase_16 WA -
testcase_17 AC 45 ms
60,416 KB
testcase_18 AC 732 ms
82,652 KB
testcase_19 AC 88 ms
77,164 KB
testcase_20 AC 591 ms
79,872 KB
testcase_21 AC 1,005 ms
81,792 KB
testcase_22 AC 61 ms
69,888 KB
testcase_23 WA -
testcase_24 AC 72 ms
69,504 KB
testcase_25 AC 60 ms
68,224 KB
testcase_26 AC 226 ms
77,228 KB
testcase_27 AC 282 ms
77,524 KB
testcase_28 AC 500 ms
77,876 KB
testcase_29 AC 240 ms
77,276 KB
testcase_30 AC 859 ms
81,068 KB
testcase_31 AC 61 ms
69,760 KB
testcase_32 WA -
testcase_33 AC 61 ms
69,384 KB
testcase_34 AC 139 ms
77,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#input = sys.stdin.readline
input = sys.stdin.buffer.readline
import math
import copy
from collections import defaultdict 


def main():
    N,K = map(int,input().split()); MOD = pow(10,9) + 7
    A = list(map(int,input().split()))

    #dp[v]:vで割れる値
    dp = defaultdict(int)
    dp[1] = 1
    for i,a in enumerate(A):
        p = copy.copy(dp)
        p,dp = dp,p
        for v in p:
            nv = math.gcd(K,v*a)
            dp[nv] += p[v]
            dp[nv] %= MOD
    ans = dp[K]%MOD
    print(ans)

if __name__ == '__main__':
    main()
0