There are N employees already working for a company and M new candidates eligible for the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
We are using Greedy approach here You just need to calculate how much money does co... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
You are a new financial analyst working for a company thats more than 100 years old. The CFO has asked you and a young member of the accounting staff to work together in reviewing the firms capital...
-
At the end of the financial year ended 30 June 2015, the trial balance of Veronica, Valda and Victoria is as shown below. Victoria made her advance before 1 July 2014. Veronica and Valda each...
-
You are a management accountant working for a company called BHP, which manufactures iron ore. BHP's investment to progress the development of ground-breaking technology to reduce carbon emissions...
-
The Chicago Omni Hotel is a 750-room luxury hotel offering guests the finest facilities in downtown Chicago. The hotel is organized into four departments: lodging, dining, catering, and retail...
-
Suppose that a business has developed a very high quality product and operates more efficiently in producing that product than any other potential competitor. As a consequence, at present it is the...
-
Calculate the 95% confidence interval for the following fictional data regarding daily TV viewing habits: = 4.7 hours; = 1.3 hours; sample of 78 people, with a mean of 4.1 hours.
-
Using the variance data for Menounos Manufacturing Co., prepare an income statement through gross profit for the year ended December 31, 20Y6. Assume the company sold 3,000 units at $100 per unit.
-
Buckeye Manufacturing produces heads for engines used in the manufacture of trucks. The production line is highly complex, and it measures 900 feet in length. Two types of engine heads are produced...
-
below is the code for quick sort. Modify this code so it runs in O(nlogn) time on sorted input. int partition(std::vector arr, int p, int r) int pivot int i=p for (int arr[r]; 1; p;j
-
Three different analytical methods are compared for determining Ca in a biological sample. The laboratory is interested in knowing whether the methods differ. The results shown below represent Ca...
-
What variables have to be considered in designing the organizational structure for international operations? How do these variables interact, and which do you think are most important?
-
Explain the key differences between the design school and the learning school.
-
Describe the four dimensions of culture proposed by Hofstede. What are the managerial implications of these dimensions? Compare the findings with those of Trompenaars and the GLOBE project team.
-
Identify organizations where their stated values have not matched their actions, and show what, if any, the consequences of this were for the companys reputation and their revenues.
-
Describe the recent effects of financial globalization on the world economy. What actions have governments taken to offset negative effects? Are they working?
-
the BW TNFAC Draw NFA diagrams using the fewest numbers of states that realize the following languages. Assume = (0, 1): (a) A = {xx ends with 001}. (b) B= {xx contains 001}. (c) C = { contains...
-
Evaluate how many lines there are in a true rotational spectrum of CO molecules whose natural vibration frequency is w = 4.09 1014 s1 and moment of inertia I = 1.44 1039 g cm2.
-
Suppose Wings and Nantucket of the previous problem agreed to assume a $300,000 residual value for the plane at the end of the lease. How much will Wings have to pay monthly to give Nantucket its 12%...
-
The Bubar Building Co. has the following current financial results ($000). On the average, other building companies pay about one-quarter of their earnings in dividends, earn about six cents on the...
-
The central issue underlying the study of leverage is whether or not it influences stock price and whether theres an optimal structure. But the whole idea seems kind of fuzzy and uncertain. Why are...
-
You are studying survival times for mice given a drug at one of three doses (Low, Medium, or High). You define two dummy variables: (a) With these definitions, write the expressions for the mean...
-
The data in Table 8.25 were collected in order to study factors affecting the supply and demand for commercial air travel. Data on various aspects of commercial air travel for an arbitrarily chosen...
-
It is beneficial to be able to estimate the yield of useful product of a tree based on measurements of the tree taken before it is harvested. Measurements on four such variables were taken on a...
Study smarter with the SolutionInn App