Answered step by step
Verified Expert Solution
Question
1 Approved Answer
There are N employees already working for a company and M new candidates eligible for the work. At the end of the financial year,
There are N employees already working for a company and M new candidates eligible for the work. At the end of the financial year, each of the N employees demand for an increment. You are provided with the data of current_salary and the salary he/she expects. Also, there are M candidates we can recruit. We have the data of salary demanded by each eligible candidate. The company can spend maximum of X units of money. Now you have to decide whether we should give increment to the existing employee or hire a new employee. Our aim is to maximise the staff, considering that existing staff and new applicants are at same level of knowledge and experience. Input Format: First line: 3 integers N, M, X Each of the next N lines contains two integers a and bi, where ai is the current salary of the employee and b; is the salary he/she expects. Next line contains M integers c, corresponding to the salary demanded by th candidate. Output Format: Output a single integer denoting total number of employees working for the company after this process. Output Format: Output a single integer denoting total number of employees working for the company after this process. Input Constraints: 1 M 105 1 N 105 1 ai, bi, ci, X < 10 ai bi Sample Input % 5 3 20 10 15 78 8 10 15 17 200 300 10 2 7 Sample Output 6 Explanation The best way to tackle this problem is hire candidate 2 and 3, and retain the employee 1, 2, 3 and 4. So we will have a maximum of 6 employees at the end.
Step by Step Solution
★★★★★
3.45 Rating (161 Votes )
There are 3 Steps involved in it
Step: 1
We are using Greedy approach here You just need to calculate how much money does co...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