MSBOP 2015 Round3 register

Ended

Participants:978

Verdict:AC | TLE
Submitted:2015-05-09 15:00:26

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 <unordered_map>
#include <vector>
using namespace std;
void sumhuo(int cur, unordered_map<int, vector<int>> &mat, unordered_map<int, int> &huo, unordered_map<int, bool> &issum)
{
    issum[cur] = true;
    vector<int> nei = mat[cur];
    for (int j : nei)
    {
        if (issum[j])
            continue;
        sumhuo(j, mat, huo,issum);
        huo[cur] += huo[j];
    }
    
}
int findmax(int cur, unordered_map<int, vector<int>> &mat, unordered_map<int, int> &huo)
{
    vector<int> nei = mat[cur];
    int res = 0;
    for (int j : nei)
    if (res < huo[j])
        res = huo[j];
    return res;
}
int main()
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX