hihoCoder Challenge 14 register

Ended

Participants:709

Verdict:Accepted
Submitted:2015-08-30 20:06:32

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;
const int maxn = 100000+10;
vector<int> G[maxn];
multiset<int> son[maxn];
typedef multiset<int>::iterator it;
int sz[maxn],dep[maxn];
int n;
int ans;
void dfs(int u,int fa,int d)
{
    sz[u]=1;
    dep[u]=d;
    for(int i=0;i<G[u].size();i++)
    {
        int v = G[u][i];
        if(v==fa) continue;
        dfs(v,u,d+1);
        son[u].insert(sz[v]);
        sz[u]=max(sz[u],sz[v]+1);
    }
}
int main()
{
    while(~scanf("%d",&n))
    {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX