hiho Week 17 register

Ended

Participants:394

Verdict:Accepted
Score:100 / 100
Submitted:2014-10-26 21:05:06

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>
#include <iostream>
#include <string>
#include <map>
#include <assert.h>
using namespace std;
struct node
{
    string strname;
    int narrId, nlevel;
};
int arrSt[20000][14], nStindex = 1;
int arrpow[15] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384};
node arrnode[11000]; 
int arrto[20002], arrnext[20002], arrhead[10000];
int ntoalside = 1;
void add(int x, int y)
{
    arrto[ntoalside] = y;
    arrnext[ntoalside] = arrhead[x];
    arrhead[x] = ntoalside++;
}
void dfs(int nindex, int nparent, int nlevel)
{
    arrnode[nindex].nlevel = nlevel;
    int nChildSidId = arrhead[nindex];
    for (; nChildSidId != 0; nChildSidId = arrnext[nChildSidId])
        if (arrto[nChildSidId] != nparent)
        {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX