RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
문제 COCI00710

Drzava

설명

In a distant land called Airlanvaosma-i there are \(n\) cities connected by \(n - 1\) roads.
It is possible to reach every city from any other city by passing through fewer than
36 roads.
The almighty Krešimir wants to found his own state. Krešimir’s state must have
one capital city from which the state is governed, and several (possibly none)
secondary cities that are under its administration. The size of a state is equal to
the total number of cities that belong to that state (the capital city and all secondary cities).
However, in order for the governance of the state to be efficient, Krešimir imposes the following rule:
• for every secondary city, on the path from the capital city to that secondary city there must be no
other secondary city. In other words, no secondary city may lie between the capital city and another
secondary city.
For every state size \(k\), where \(1 \le k \le n\), determine how many different states of size \(k\) the almighty
Krešimir can found. Since these numbers can be very large, output them modulo \(10^{9} + 7\).
Two choices of states are considered different if they differ in at least one chosen secondary city or in the
choice of the capital city.

제약
입력 형식

The first line contains a natural number \(n\) (\(1 \le n \le 3000\)), the number of cities in the land.
In the next \(n - 1\) lines there are two natural numbers \(u\) and \(v\) (\(1 \le u\), \(v \le n\), u̸ = \(v\)), which indicate that
cities \(u\) and \(v\) are connected. It will be possible to reach every city from any other city.

출력 형식

In the first and only line output \(n\) numbers, the numbers described in the problem statement.

서브태스크
서브태스크점수설명

1

18점

\(1 \le n \le 15\)

2

17점

\(1 \le n \le 200\)

3

26점

\(1 \le n \le 600\)

4

49점

No additional constraints.

예제 1
입력
4
1 2
1 3
1 4
출력
4 12 6 1
예제 2
입력
4
1 2
2 3
1 4
출력
4 12 4 0
설명

Explanation of the second sample test: There are 4 states of size 1 because there are 4 choices for
the capital city. There are 4 states of size 2 because after choosing the capital city (4 ways), we also
choose 1 secondary city (3 ways). There are 4 states of size 3 because by choosing capital cities 1 or 2 we
have 2 ways each to choose 2 additional secondary cities.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2025/2026 Contest 3

평가 및 의견

Drzava

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Drzava

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8