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

18458번 - Airplane Cliques 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB267637.500%

문제

There are n cities in Saint Waterloo. They are connected with n − 1 undirected airlines, such that it is possible to get from any city to any other city by using airlines.

Let’s say that the two cities are in a good relationship if it is possible to get from one to another using at most x flights.

Additionally, let’s say that the set of k cities is friendly if all pairs of cities in it are in a good relationship.

You need to find the number of friendly sets of cities for each k, such that 1 ≤ k ≤ n. As these values may be very large, find them modulo 998 244 353.

입력

The first line of input contains two integers n, x (1 ≤ n ≤ 300 000, 0 ≤ x ≤ n − 1): the number of cities in Saint Waterloo and x.

The next n − 1 lines contain descriptions of edges, such that the i-th line contains two integers a, b (1 ≤ a, b ≤ n), the indices of cities connected by the i-th airline.

출력

Print n integers: the number of friendly sets of 1, 2, . . . , n cities, modulo 998 244 353.

제한

예제 입력 1

1 0

예제 출력 1

1

예제 입력 2

5 1
1 2
2 3
3 4
4 5

예제 출력 2

5 4 0 0 0

예제 입력 3

4 2
1 2
1 3
1 4

예제 출력 3

4 6 4 1

힌트

In the second example, all possible friendly sets are of size 1 and 2, and the number of friendly sets for these sizes is the number of cities and the number of airlines, respectively.

In the third example, it is possible to get from any city to any other city using at most x flights, so the number of friendly sets of k cities is \(\binom{4}{k}\).

출처

Camp > Petrozavodsk Programming Camp > Winter 2020 > Day 3: 300iq Petrozavodsk Contest III A번

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

출처

대학교 대회

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

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