結果

問題 No.2980 Planar Tree 2
ユーザー pockyny
提出日時 2024-12-08 11:00:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 458 bytes
コンパイル時間 542 ms
コンパイル使用メモリ 71,352 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-20 11:25:26
合計ジャッジ時間 4,404 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <atcoder/modint>

using namespace std;
using namespace atcoder;
using mint = modint998244353;
int deg[200010];
mint f[200010];
int main(){
    int i,n; cin >> n;
    for(i=0;i<n - 1;i++){
        int a,b; cin >> a >> b; a--; b--;
        deg[a]++; deg[b]++;
    }
    f[0] = 1;
    for(i=1;i<=n;i++) f[i] = f[i - 1]*i;
    mint ans = 1;
    for(i=0;i<n;i++) ans *= f[deg[i]];
    ans /= f[n - 1];
    cout << ans.val() << "\n";
}
0