結果
| 問題 | No.1731 Product of Subsequence |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-29 13:15:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 270 bytes |
| 記録 | |
| コンパイル時間 | 349 ms |
| コンパイル使用メモリ | 82,556 KB |
| 実行使用メモリ | 89,496 KB |
| 最終ジャッジ日時 | 2025-01-01 22:54:10 |
| 合計ジャッジ時間 | 11,580 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 RE * 1 |
| other | AC * 28 RE * 3 |
ソースコード
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))