結果
| 問題 | No.3716 Keep it Integer |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2026-08-22 18:46:03 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 113 ms / 2,000 ms |
| + 454µs | |
| コード長 | 730 bytes |
| 記録 | |
| コンパイル時間 | 2,227 ms |
| コンパイル使用メモリ | 343,716 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-09-18 20:50:36 |
| 合計ジャッジ時間 | 7,222 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 50 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;
using ll = long long;
using mint = modint998244353;
int main() {
int N; ll X;
cin >> N >> X;
vector<ll> A(N);
for (auto& a: A) cin >> a;
unordered_map<ll, mint> dp;
dp[X] = 1;
for (const auto& a: A) {
unordered_map<ll, mint> ndp;
for (const auto& [_, cnt]: dp) {
ndp[a] += cnt;
}
for (const auto& [key, cnt]: dp) {
if (key % a == 0) {
ndp[key / a] += cnt;
}
}
swap(dp, ndp);
}
mint ans = 0;
for (const auto& [_, cnt]: dp) {
ans += cnt;
}
cout << ans.val() << '\n';
}