結果
問題 |
No.1731 Product of Subsequence
|
ユーザー |
![]() |
提出日時 | 2021-11-07 03:01:11 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,417 ms / 2,000 ms |
コード長 | 427 bytes |
コンパイル時間 | 495 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 89,216 KB |
最終ジャッジ日時 | 2024-11-08 05:05:39 |
合計ジャッジ時間 | 16,080 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 31 |
ソースコード
n, k = map(int, input().split()) A = list(map(int, input().split())) mod = 10**9+7 from collections import defaultdict import math dp = defaultdict(lambda: 0) dp[1] = 1 for a in A: nx = defaultdict(lambda: 0) for j, v in dp.items(): nx[j] += v nx[j] %= mod g = math.gcd(j*a, k) nx[g] += v nx[g] %= mod dp = nx if k == 1: print((dp[k]-1)%mod) else: print(dp[k]%mod)