[Offer收割]编程练习赛98 register

Ended

Participants:89

Verdict:Wrong Answer
Score:0 / 100
Submitted:2019-03-31 12:48:55

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>
using namespace std;
struct TreeNode{
    TreeNode(int id){
        this->id = id;
    }
    int id;
    vector<TreeNode*> employees;
    TreeNode* boss;
};
int main(){
    int n, m;
    cin>>n>>m;
    vector<TreeNode> person;
    struct TreeNode boss(-1); 
    for(int i=0; i<n; i++){
        struct TreeNode node(i);
        node.boss = &boss;
        person.push_back(node);    
    }
    for(int i=0; i<m; i++){
        int bossID, employeeID;
        cin>>bossID>>employeeID;
        person[bossID-1].employees.push_back(&person[employeeID-1]);
        person[employeeID-1].boss = &person[bossID-1];
    }
    for(int i=0; i<n; i++){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX