Logo
(追記) (追記ここまで)

18873번 - Circus 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB32121035.714%

문제

The $N$ cows of Farmer John's Circus (1ドル \leq N \leq 10^5$) are preparing their upcoming acts. The acts all take place on a tree with vertices labeled 1ドル\ldots N$. The "starting state" of an act is defined by a number 1ドル \leq K \leq N$ and an assignment of cows 1ドル\dots K$ to the vertices of the tree, so that no two cows are located at the same vertex.

In an act, the cows make an arbitrarily large number of "moves." In a move, a single cow moves from her current vertex to an unoccupied adjacent vertex. Two starting states are said to be equivalent if one may be reached from the other by some sequence of moves.

For each 1ドル \leq K \leq N,ドル help the cows determine the number of equivalence classes of starting states: that is, the maximum number of starting states they can pick such that no two are equivalent. Since these numbers may be very large, output their remainders modulo 10ドル^9 + 7$.

입력

Line 1ドル$ contains $N$.

Lines 2ドル\le i\le N$ each contain two integers $a_i$ and $b_i$ denoting an edge between $a_i$ and $b_i$ in the tree.

출력

For each 1ドル\le i\le N,$ the $i$-th line of output should contain the answer for $K=i$ modulo 10ドル^9+7$.

제한

예제 입력 1

5
1 2
2 3
3 4
3 5

예제 출력 1

1
1
3
24
120

For $K=1$ and $K=2,$ any two states can be transformed into one another.

Now consider $K=3,ドル and let $c_i$ denote the location of cow $i$. The state $(c_1,c_2,c_3)=(1,2,3)$ is equivalent to the states $(1,2,5)$ and $(1,3,2).$ However, it is not equivalent to the state $(2,1,3).$

예제 입력 2

8
1 3
2 3
3 4
4 5
5 6
6 7
6 8

예제 출력 2

1
1
1
6
30
180
5040
40320

힌트

출처

Olympiad > USA Computing Olympiad > 2019-2020 Season > USACO 2020 US Open Contest > Platinum 3번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /