結果
| 問題 | No.1731 Product of Subsequence |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-29 13:15:40 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 270 bytes |
| 記録 | |
| コンパイル時間 | 297 ms |
| コンパイル使用メモリ | 84,992 KB |
| 実行使用メモリ | 91,392 KB |
| 最終ジャッジ日時 | 2026-06-05 16:54:59 |
| 合計ジャッジ時間 | 8,935 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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))