/* #include void self::main(){ LL(N); N=N*2+1; VV(N-1,u,v);dec(u,v); auto g=make_rooted_tree(N,0,u,v); use_ml998244353 vec dp(N,2,ml{}); // dp[u][j]:uの部分木を分ける方法で,uを端点に持つ余っている辺の個数がjである場合の数. ef(g.bfs_order(),u){ dp[u][0]=1; dp[u][1]=0; ml A=1,B=1; ll Bcnt=0; fe(g[u],e){ ll v=e.to; if(dp[v][1].val())A*=dp[v][1]; else B*=dp[v][0],Bcnt++; } ll n=(odd(Bcnt)?Bcnt-1:Bcnt); ll c=2,k=n/c; dp[u][odd(Bcnt)]=A*B*fac(Bcnt)*fac_inv(c).pow(k)*fac_inv(k); } pp(dp[0][0]); } */ #include #include using namespace std; namespace self{void main();void sub();void pp(auto&&...a);} int main(){cin.tie(nullptr)->sync_with_stdio(0);cout<__VA_ARGS__;fe(refs(__VA_ARGS__),e)e.get().resize(n);vin(__VA_ARGS__) #define VV(n,...) RDVV(ll,n,__VA_ARGS__) #define fo(i,...) for(auto[i,i##stop,i##step]=for_range(0,__VA_ARGS__);i(1,__VA_ARGS__);i>=i##stop;i+=i##step) #define fe(a,e,...) for(auto&&__VA_OPT__([)e __VA_OPT__(,__VA_ARGS__]):a) #define ef(a,e,...) for(auto&&__VA_OPT__([)e __VA_OPT__(,__VA_ARGS__]):ranges::reverse_view(a)) #define use_ml998244353 using ml=atcoder::modint998244353; namespace self{ auto&operator<<(ostream&o,const atcoder::modint998244353&x){return o<<(int)x.val();} using ll=long long; constexpr auto refs(auto&...a){return array{ref(a)...};} templateconstexpr auto for_range(T s,T b){T a=0;if(s)swap(a,b);return array{a-s,b,1-s*2};} templateconstexpr auto for_range(T s,T a,T b,T c=1){return array{a-s,b,(1-s*2)*c};} void lin(auto&...a){(cin>>...>>a);} void vin(auto&...a){fo(i,(a.size()&...))(cin>>...>>a[i]);} constexpr auto odd(auto x){return x&1;} void dec(auto&...a){((--a),...);} templateusing pack_back_t=tuple_element_t>; } namespace self{ templateconcept vectorial=is_base_of_v::value_type>,remove_cvref_t>; templateconstexpr int depth=0; templateconstexpr int depth =depth+1; templatestruct core_t_helper{using type=T;}; templatestruct core_t_helper{using type=typename core_t_helper::type;}; templateusing core_t=core_t_helper::type; templatestruct vec; templatestruct hvec_helper{using type=vec::type>;}; templatestruct hvec_helper<0,T>{using type=T;}; templateusing hvec=hvec_helper::type; templatestruct vec:vector{ static constexpr int D=depth+1; using C=core_t; using vector::vector; vec(const auto&...a)requires(sizeof...(a)>=3){assign_all(a...);} void assign_all(const auto&...a){if constexpr(sizeof...(a)==D){ }else*this=make(a...);} static auto make(ll n,const auto&...a){ if constexpr(sizeof...(a)==1)return vec(n,array{a...}[0]); else return vec(n,make(a...)); } vec&operator--(){fe(*this,e)--e;return*this;} ll size()const{return vector::size();} auto&emplace_back(auto&&...a){vector::emplace_back(std::forward(a)...);return*this;} }; templaterequires(sizeof...(A)>=2)vec(const A&...a)->vec>>; } namespace self{ templateT fac(ll n){static vecv{1};if(ll m=v.size();m<=n){v.resize(n+1);fo(i,m,n+1)v[i]=v[i-1]*i;}return v[n];} templateT fac_inv(ll n){static vecv{1};if(ll m=v.size();m<=n){v.resize(n+1);v[n]=fac(n).inv();of(i,n,m)v[i]=v[i+1]*(i+1);}return v[n];} } namespace self{ templatestruct queue:std::queue{ queue()=default; queue(const initializer_list&a){fe(a,e)this->emplace(e);} ll size()const{return std::queue::size();} T pop(){T r=this->front();std::queue::pop();return r;} }; } namespace self{ templatestruct edge{ int from,to; WT wt; int id; edge()=default; edge(int from,int to,WT wt=1,int id=-1):from(from),to(to),wt(wt),id(id){} }; } namespace self{ templateclass RootedTree{ public: ll n_; vec>>edges_; vec>rev_edge_; int root_; RootedTree()=default; RootedTree(ll n,ll r):n_(n),edges_(n),rev_edge_(n,{-1,-1,WT{},-1}),root_(r){} const auto&operator[](ll u)const{return edges_[u];} void set_edge(const edge&e){ edges_[e.from].eb(e); rev_edge_[e.to]=e; } auto bfs_order(ll start=-1)const{ if(start==-1)start=root_; vecord; queueq{start}; while(q.size()){ ll u=q.pop(); ord.eb(u); fe(edges_[u],e)q.emplace(e.to); } return ord; } }; } namespace self{ templateclass Graph{ ll n_; vec>>edges_; public: Graph()=default; Graph(ll n):n_(n),edges_(n){} auto&add_edges(const vec&a,const vec&b){fo(i,a.size())edges_[a[i]].eb(a[i],b[i],1,i);return*this;} auto bfs_tree(int s)const{ RootedTreetree(n_,s); vecused(n_); used[s]=1; queueq; q.emplace(s); while(q.size()){ auto u=q.pop(); fe(edges_[u],e){ auto v=e.to; if(used[v])continue; used[v]=1; tree.set_edge(e); q.emplace(v); } } return tree; } }; } namespace self{ templateauto make_rooted_tree(ll n,ll r,const vec&a,const vec&b){ Graphg(n); return g.add_edges(a,b).add_edges(b,a).bfs_tree(r); } } void self::pp(auto&&...a){const char*c="";((cout<(Bcnt)*fac_inv(c).pow(k)*fac_inv(k); } pp(dp[0][0]); }