hiho Week 11 register

Ended

Participants:433

Verdict:Accepted
Score:100 / 100
Submitted:2014-09-17 13:36:16

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<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;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX