예제 #1
0
int Contour::getLeastImportant(){
	int   min_idx = 0;
	float min_val = getImportance(0);
	for (unsigned int i = 1; i < _points.size(); i++){
		float val = getImportance(i);
		if (val < min_val){
			min_idx = i;
			min_val = val;
		}
	}
	return min_idx;
}
 int getImportance(vector<Employee*> employees, int id) {
     unordered_map<int,Employee*> m;
     for (Employee* e : employees) {
         m[e->id] = e;
     }
     return getImportance(m, id);
 }
 int getImportance(unordered_map<int,Employee*>& m, int id) {
     int ans = 0;
     ans += m[id]->importance;
     for (int subid : m[id]->subordinates) {
         ans += getImportance(m, subid);
     }
     return ans;
 }