hiho week 109 register

Ended

Participants:438

Verdict:Accepted
Score:100 / 100
Submitted:2016-08-05 22:16:51

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<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
const int maxn = 10005;
const int inf = 2e9;
struct Node
{
    vector<int> child;
}tree[maxn];
int n,p[maxn],q[maxn];
int pt[maxn],qt[maxn];
bool cmp(int a,int b)
{
    return qt[a] > qt[b];
}
void dfs(int u,int fa)
{
    int Wallet = inf;
    int minWallet = inf;
    vector<int> V = tree[u].child;
    for(int i = 0; i < V.size(); i++)
    {
        int v = V[i];
        if(v == fa) continue;
        dfs(v,u);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX