e********2 发帖数: 495 | 1 报错
required from 'std::pair<_T1, _T2>::pair(std::piecewise_construct_t, std::
tuple<_Args1 ...>, std::tuple<_Args2 ...>) [with _Args1 = {const int&}; _
Args2 = {}; _T1 = const int; _T2 = std::pair&>]'
class Employee {
public:
int id;
int importance;
std::vector subordinates;
};
class Solution_690 {
public:
int aux(std::unordered_map&>>&
parents, int ind) {
int res = parents[ind].first;
for (auto& t : parents[ind].second) {
res += aux(parents, t);
}
return res;
}
int getImportance(std::vector employees, int id) {
std::unordered_map&>> parents;
for (auto& p : employees) {
parents[p->id] = { p->importance, p->subordinates }; //<---
Error here
}
return aux(parents, id);
}
}; |
|