Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are a project manager in a large IT company. You need to select a team of employees to work on a project. You have
You are a project manager in a large IT company. You need to select a team of employees to work on a project. You have a list of employees who are eligible for the selection. Employees are indexed from to N
However, there is a certain rule that must be followed in order to select the team. There are some employees who have some personal conflicts and they can't be in a team together. Also, each employee has a skill value assigned to them, representing their level of expertise. As a project manager, your task is to select a team of employees such that the total expertise of the team should be maximum, keeping the employees incompatibility in mind. Two employees are said to be incompatible if they have any conflicts among them
Given the employees, their level of expertise value and employee pairs with conflicts, find the maximum possible expertise of the team.
Note: The selected team can contain one employee also
Constraints
n
c
expertisei
Input
First line consists of two integers nc separated by space, representing the number of employees and number of pairs having conflicts. Next c lines, each consists of two integers separated by space. These represents the id of the employees having conflicts between them.
Last line consists of n integers separated by space, where it integer represents the expertise level of ith employee
Output
Print a single integer denoting the maximum possible expertise of the team
Time Limit secs
Examples
Example
Input
Output
Explanation
You can form a team with employees who don't have any conflicts among themselves and the total expertise of the team is the sum of skill values of all employees ie No other combination of employees will give an expertise which is greater than
Example
Input
Output
Explanation
You can form a team with employees who don't have any conflicts among themselves and the total expertise of the team is the sum of skill values of all employees Le No other combination of employees will give an expertise which is greater than
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started