結果
問題 | No.2980 Planar Tree 2 |
ユーザー |
|
提出日時 | 2024-12-05 07:05:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 63 ms / 2,000 ms |
コード長 | 540 bytes |
コンパイル時間 | 4,116 ms |
コンパイル使用メモリ | 251,616 KB |
最終ジャッジ日時 | 2025-02-26 10:56:22 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/all>using namespace std;using mint = atcoder::modint998244353;int main(){ios::sync_with_stdio(false);cin.tie(0);int n;cin >> n;vector<int> cnt(n);for(int i = 1; i < n; i++){int u, v;cin >> u >> v;cnt[--u]++, cnt[--v]++;}vector<mint> fact(n + 1);fact[0] = 1;for(int i = 1; i <= n; i++) fact[i] = i * fact[i - 1];mint ans = 1 / fact[n - 1];for(auto &&v : cnt) ans *= fact[v];cout << ans.val() << '\n';}