hiho week 217 register

Ended

Participants:160

Verdict:Accepted
Score:100 / 100
Submitted:2018-08-27 09:50:54

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 <bits/stdc++.h>
#pragma warning(disable:4996)
using namespace std;
int n;
int fa[105];
int ch[105][2];
int chnum[105];
int dp[105];
int rval[105];
int opid[105];
char s[10];
int mroot;
const int INF = 105 * 105;
void dfs(int u)
{
    if (chnum[u] == 0)
    {
        dp[u] = INF;
        rval[u] = opid[u] - 2;
        return;
    }
    int ch1 = ch[u][0];
    int ch2 = ch[u][1];
    dfs(ch1);
    dfs(ch2);
    
    if (opid[u] == 0)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX