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

30437번 - Factor-Full Tree 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB148302722.881%

문제

Aivar is very good at number theory. In fact, it is the only thing he is good at, but this doesn't stop him from achieving great things. However, if Aivar wants to solve any problem in life, he first needs to convert it to number theory.

For example, consider a rooted tree with $N$ vertices. In order to deal with such structures, Aivar first constructs a divisor labelling of the tree. A divisor labelling is a way to label each vertex $v$ with a positive integer $x_v$ so that $v$ is an ancestor of $u$ if and only if $x_v$ divides $x_u$.

After constructing such a labelling, Aivar can simply forget about the tree and just think about the list of numbers $x_1, x_2, \dots, x_N$.

You are given a rooted tree with $N$ vertices, and your task is to find a divisor labelling. The vertices are numbered from 1ドル$ to $N,ドル and 1ドル$ is the root.

입력

The first line contains an integer $N$ (1ドル \leq N \leq 60$).

The following $N-1$ lines each contain two integers $u$ and $v$ (1ドル \leq u, v \leq N,ドル $u \neq v$), meaning that an edge goes between vertices $u$ and $v$. These edges will form a tree.

출력

Print one line with $N$ integers, the numbers $x_1, x_2, \dots x_N$. These numbers must satisfy 1ドル \leq x_i \leq 10^{18}$. It can be shown that under these constraints, an answer always exists.

제한

예제 입력 1

5
1 2
1 3
3 4
3 5

예제 출력 1

1 2 3 21 33

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Nordic Collegiate Programming Contest > NCPC 2023 F번

  • 문제를 만든 사람: Nils Gustafsson
(追記) (追記ここまで)

출처

대학교 대회

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

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