結果

問題 No.1731 Product of Subsequence
ユーザー tassei903tassei903
提出日時 2021-11-06 10:07:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 812 bytes
コンパイル時間 366 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 85,376 KB
最終ジャッジ日時 2024-04-24 20:04:05
合計ジャッジ時間 15,590 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,120 ms
84,096 KB
testcase_01 AC 41 ms
53,888 KB
testcase_02 AC 40 ms
54,272 KB
testcase_03 AC 42 ms
53,760 KB
testcase_04 AC 43 ms
54,016 KB
testcase_05 AC 53 ms
63,232 KB
testcase_06 AC 53 ms
63,616 KB
testcase_07 AC 42 ms
54,144 KB
testcase_08 AC 113 ms
76,544 KB
testcase_09 WA -
testcase_10 AC 1,349 ms
85,120 KB
testcase_11 AC 1,137 ms
83,328 KB
testcase_12 AC 69 ms
67,328 KB
testcase_13 AC 142 ms
77,568 KB
testcase_14 AC 1,063 ms
82,048 KB
testcase_15 AC 42 ms
54,016 KB
testcase_16 WA -
testcase_17 AC 40 ms
54,016 KB
testcase_18 AC 1,045 ms
84,096 KB
testcase_19 AC 133 ms
77,312 KB
testcase_20 AC 778 ms
81,664 KB
testcase_21 AC 1,307 ms
85,376 KB
testcase_22 AC 65 ms
68,480 KB
testcase_23 WA -
testcase_24 AC 105 ms
76,928 KB
testcase_25 AC 87 ms
72,960 KB
testcase_26 AC 303 ms
77,568 KB
testcase_27 AC 372 ms
77,696 KB
testcase_28 AC 648 ms
79,104 KB
testcase_29 AC 319 ms
77,568 KB
testcase_30 AC 1,161 ms
84,736 KB
testcase_31 AC 73 ms
68,480 KB
testcase_32 WA -
testcase_33 AC 65 ms
68,864 KB
testcase_34 AC 196 ms
77,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
sys.setrecursionlimit(10**7)
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
mod = 10**9+7
n,k = na()
if k==1:
    print((pow(2,n,mod)-1)%mod)
a = na()
from collections import defaultdict
from math import gcd
dp = defaultdict(int)
dp[1] = 1

mod = 10**9+7
for i in range(n):
    p = defaultdict(int)
    p,dp = dp,p
    for j in p:
        nj = gcd(k,j*a[i])
        dp[nj]+=p[j]
        dp[j]+=p[j]
        if dp[nj]>=mod:
            dp[nj]-=mod
        if dp[j]>=mod:
            dp[j]-=mod
print(dp[k])
0