1 #define MAXN 10150UL 2 3 #include4 #include 5 #include 6 7 using namespace std; 8 struct Node{ 9 int fa,sd,id,son[3];10 }op[MAXN];11 int cnt,p,maxn[MAXN][3],minn[MAXN][3];12 int maxans=0,minans=505290270;13 string s;14 int MIN(int a,int b){15 if(a >s;71 dfs(0);72 /* for(int i=1;i<=cnt;i++){73 printf("%d\n",op[i].sd);74 }*/75 memset(minn,30,sizeof(minn));76 dp(1); 77 /* for(int i=1;i<=cnt;i++)78 printf("%d %d %d\n",minn[i][0],minn[i][1],minn[i][2]);*/79 printf("%d %d",MAX(MAX(maxn[1][0],maxn[1][1]),maxn[1][2]),MIN(MIN(minn[1][0],minn[1][1]),minn[1][2]));80 }