Company: Zorvyn SDE_3april
Difficulty: medium
Problem Statement A company has N employees numbered from 1 to N . Employee 1 is the CEO, and every other employee has exactly one direct manager, forming a tree structure (corporate hierarchy). Each employee i has a productivity value P[i] which can be positive (good performer), negative (problematic), or zero. The company wants to select a subset of employees for a special project. However, there is a constraint: if an employee is selected, their direct manager cannot be selected (and vice versa). This is because the project requires independent decision-making. Find the maximum sum of productivity values achievable by selecting a valid subset of employees. Input Format First line contains a single integer N . Second line contains N space-separated integers representing productivity values P[1], P[2], ..., P[N] . Next N-1 lines each contain two integers u and v representing that u is the direct manager of v . Output Format Print a single integer - the maximum sum of productivity valu