結果
| 問題 | No.3826 PRiSM Net |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-11-05 09:32:09 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 54 ms / 2,000 ms |
| + 222µs | |
| コード長 | 1,256 bytes |
| 記録 | |
| コンパイル時間 | 1,298 ms |
| コンパイル使用メモリ | 185,284 KB |
| 実行使用メモリ | 18,896 KB |
| 最終ジャッジ日時 | 2026-11-22 12:36:37 |
| 合計ジャッジ時間 | 2,817 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 |
ソースコード
#include <iostream>
#include <ranges>
#include <vector>
#include <numeric>
#include <atcoder/modint>
namespace atcoder {
template <int m>
std::ostream& operator<<(std::ostream& os, const static_modint<m>& mint) {
os << mint.val();
return os;
}
}
int main() {
using namespace std;
using modint = atcoder::static_modint<998244353>;
unsigned T;
cin >> T;
constexpr unsigned query_max{2000000};
vector<modint> fact(query_max + 1), ifact(query_max + 1);
iota(begin(fact), end(fact), modint{});
fact.front() = 1;
inclusive_scan(begin(fact), end(fact), begin(fact), multiplies{});
iota(begin(ifact), end(ifact), modint{1});
ifact.back() = fact.back().inv();
inclusive_scan(rbegin(ifact), rend(ifact), rbegin(ifact), multiplies{});
const auto binom{[&fact, &ifact](const auto n, const auto r) -> modint {
if (n < r) return 0;
return fact[n] * ifact[r] * ifact[n - r];
}};
for ([[maybe_unused]] const auto _ : views::repeat(monostate{}, T))[binom] {
unsigned N, K, L;
cin >> N >> K >> L;
cout << (2 * binom(N + K + L - 2, N - K - L) + binom(N + K + L - 2, N - K - L + 1)) * N * binom(K + L - 2, K - 1) << endl;
}();
return 0;
}