hiho week 309 register

Ended

Participants:37

Verdict:Accepted
Score:100 / 100
Submitted:2020-06-06 14:27:29

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 <stdio.h>
struct _tree
{
    int children ;
    int brother ;
    int parent ;
    long long int time ;
    long long int a ;
} ;
struct _tree tree[101000] ;
long long int solve( int tag )
{
    int p ;
    long long int cost ;
    long long int max = -1 ;
    p = tree[tag].children ;
    long long int ret = 0 ;
    int childrenCnt = 0 ;
    long long int sum = 0 ;
    while ( p != -1 )
    {
        ret += solve( p ) ;
        if ( tree[p].time > max )
            max = tree[p].time ;
        ++childrenCnt ;
        sum += tree[p].time ;
        p = tree[p].brother ;
    }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX