//http://acm.hdu.edu.cn/showproblem.php?pid=2196 #include #include #include #include using namespace std; const int maxn=10005; int n,d[maxn],f[maxn],val[maxn][2]; vector G[maxn],E[maxn]; void dfs1(int u) { for(int i=0;ival[u][0]) { val[u][1]=val[u][0]; val[u][0]=t; } else val[u][1]=max(val[u][1],t); } for(int i=0;i