포럼
문제 ICPC00355

J. Jungle Job

설명

Your local jungle is being taken over by monkeys! Trees are quickly being colonized by them! As a Brave Ape Pictures Collector, this is your chance of taking sooo many pictures of primates that for sure will amaze your colleagues.

In particular, each day, one new monkey discovers your favourite tree containing \(n\) branches. From your long experience observing primates, you know two things. First, each branch of the tree only has room for a single monkey. Second, monkeys are very social animals and always stick together in groups, that is, the branches they occupy form a single connected component.

This particular invasive species of monkeys happens to be new to you and you have not yet learned to distinguish them from each other. Still you wonder: how many different pictures of the monkey colony could you take on each day, until the tree is full of monkeys?

As an example, consider the first sample case, visualized in Figure . On the third day, there are four different pictures you can take of the monkey colony.

Monkey image from freevector.com

Given the exact structure of your favourite tree, determine for each day from \(1\) to \(n\) the number of different sets of branches the monkeys could occupy on that day, modulo \(10^9+7\).

제약
입력 형식

The input consists of:
- One line with an integer \(n\) (\(1\leq n\leq 1000\)), the number of branches in the tree.
- \(n-1\) lines, the \(i\)th of which ((1\leq i\leq n-1)) contains an integer \(p_i\) (\(0\leq p_i), indicating that branch \(i\) is connected to the upper end of branch \(p_i\).

The branches are numbered from \(0\) to \(n-1\), inclusive. Branch \(0\) is connected to the roots of the tree and can also host a single monkey.

출력 형식

Output \(n\) integers. The \(k\)th integer should be the number of connected subtrees that consist of exactly \(k\) branches, modulo \(10^9+7\).

예제 1
입력
5
0
0
1
1
출력
5
4
4
3
1
예제 2
입력
3
0
1
출력
3
2
1
문제 정보

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

출처 ICPC BAPC 2023

평가 및 의견

J. Jungle Job

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

Log in to rate problems.

개별 의견

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

풀이 제출

J. Jungle Job

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