### Problem
Worker i has positive quality[i] and minimum acceptable wage[i]. Hire exactly k workers, paying every selected worker one shared rate times that worker's quality, while meeting every minimum wage. Return the least total pay as double. The source requests an answer within 0.00001 of the optimum.
**Practice tolerance:** Accept an answer when its absolute error or relative error is at most 0.00001. This tolerance permits the double return type at large valid totals.
```cpp
class Solution {
public:
double mincostToHireWorkers(vector<int>& quality, vector<int>& wage, int k);
};
```
### Examples
**Example 1:**
```text
quality = [2,4], wage = [6,8], k = 2
Output: 18.0
Explanation: Shared rate3 pays6 and12, satisfying both minimums.
```
**Example 2:**
```text
quality = [3,5], wage = [9,5], k = 1
Output: 5.0
Explanation: Hire the second worker alone at its minimum5.
```
### Constraints
- Both arrays share length n, with 1 <= k <= n <=10000.
- Qualities and minimum wages lie in [1,10000].
- The answer tolerance is absolute-or-relative error 0.00001.
### Contract considerations
Preserve exactly k hires, proportional pay and all wage minimums.
```hint Read the boundary condition
For a fixed feasible common rate, which k qualities minimize total pay?
```
### Boundary reminders
Preserve exactly k hires, proportional pay and all wage minimums.
Overview: Hire an Exactly Sized Group with Proportional Pay. Worker i has positive quality[i] and minimum acceptable wage[i].
Worker i has positive quality[i] and minimum acceptable wage[i]. Hire exactly k workers, paying every selected worker one shared rate times that worker's quality, while meeting every minimum wage. Return the least total pay as double. The source requests an answer within 0.00001 of the optimum.
Practice tolerance: Accept an answer when its absolute error or relative error is at most 0.00001. This tolerance permits the double return type at large valid totals.
class Solution {
public:
double mincostToHireWorkers(vector<int>& quality, vector<int>& wage, int k);
};
Examples
Example 1:
quality = [2,4], wage = [6,8], k = 2
Output: 18.0
Explanation: Shared rate3 pays6 and12, satisfying both minimums.
Example 2:
quality = [3,5], wage = [9,5], k = 1
Output: 5.0
Explanation: Hire the second worker alone at its minimum5.
Constraints
Both arrays share length n, with 1 <= k <= n <=10000.
Qualities and minimum wages lie in [1,10000].
The answer tolerance is absolute-or-relative error 0.00001.
Contract considerations
Preserve exactly k hires, proportional pay and all wage minimums.
Boundary reminders
Preserve exactly k hires, proportional pay and all wage minimums.