#630
Unrated
Triples of Cows
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

There are initially N1N-1 pairs of friends among FJ's NN (2N21052\le N\le 2\cdot 10^5) cows labeled 1N1\dots N, forming a tree. The cows are leaving the farm for vacation one by one. On day ii, the iith cow leaves the farm, and then all pairs of the iith cow's friends still present on the farm become friends.

For each ii from 11 to NN, just before the iith cow leaves, how many ordered triples of distinct cows (a,b,c)(a,b,c) are there such that none of a,b,ca,b,c are on vacation, aa is friends with bb, and bb is friends with cc?

입력

The first line contains NN.

The next N1N-1 lines contain two integers uiu_i and viv_i denoting that cows uiu_i and viv_i are initially friends (1ui,viN1\le u_i,v_i\le N).

출력

The answers for ii from 11 to NN on separate lines.

예제 입력 1

3
1 2
2 3

예제 출력 1

2
0
0

예제 입력 2

4
1 2
1 3
1 4

예제 출력 2

6
6
0
0

예제 입력 3

5
3 5
5 1
1 4
1 2

예제 출력 3

8
10
2
0
0

점수

Inputs 4-5: N500N\le 500Inputs 6-10: N5000N\le 5000Inputs 11-20: No additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.