結果
問題 |
No.2980 Planar Tree 2
|
ユーザー |
|
提出日時 | 2024-12-05 07:05:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 44 ms / 2,000 ms |
コード長 | 540 bytes |
コンパイル時間 | 4,018 ms |
コンパイル使用メモリ | 252,284 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-06-20 11:25:02 |
合計ジャッジ時間 | 6,229 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#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'; }