Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include<iostream>#include<vector>using namespace std;int mymax=0;int process(vector<vector<int> >& tmp,int begin ,int end){if(tmp[begin].size()==0) return 0;int first=0;int second=0;for(int j=0;j<tmp[begin].size();j++){int t=0;t=process(tmp,tmp[begin][j],end)+1;if(t>first){second=first;first=t;}else if(t>second){second=t;}}if(first+second>mymax)mymax=first+second;