hiho Week 12 register

Ended

Participants:337

Verdict:Accepted
Score:100 / 100
Submitted:2014-09-27 10:25:48

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>
#include <algorithm>
#include <string>
using namespace std;
class node{
public:
    int value;
    vector<int> descendents;
    char father;
    vector<int> bestm;
    node(int v,int M):value(v),father(0),bestm(M,v){};
};
int main(){
int M,N;
cin>>N>>M;
void cacuAns(node&,int, vector<node>&);
vector<node>  nodes;
int temp;
for(int i=0;i!=N;i++){
        cin>>temp;
        nodes.push_back(node(temp,M));
}
int starts,ends,root;
for(int i=0;i!=N-1;i++){
    cin>>starts>>ends;
    nodes[starts-1].descendents.push_back(ends);
    nodes[ends-1].father=starts;
    if(nodes[starts-1].father==0)root=starts;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX