Problem Statement: Process Execution on Processors
You are given a list of processes, each with a certain power consumption. You are also given a list of processors, each defined by a minimum and maximum power bound. The task is to determine, for each processor, how many processes can be executed (i.e., have power consumption within the processor's bounds) and the total power consumption of those processes.
Function Description
You need to complete the function processExecution:
-
Parameters:
- power: An array of integers where each integer represents the power consumption of a process.
- minPower: An array of integers where each integer represents the minimum power bound of a processor.
- maxPower: An array of integers where each integer represents the maximum power bound of a processor.
-
Returns:
- A 2-dimensional array where each element is a vector of two integers. The first integer is the number of processes that can be executed by the processor, and the second integer is the sum of the power consumption of those processes.
Constraints:
- 1 ≤ n ≤ 2 × 10^5, where n is the length of the power array.
- 1 ≤ m ≤ 2 × 10^5, where m is the length of the minPower and maxPower arrays.
- 1 ≤ power[i] ≤ 10^8 for all i from 1 to n.
- 1 ≤ minPower[i] ≤ maxPower[i] ≤ 10^8 for all i from 1 to m.
Example:
Input:
3
11 11 11
2
8 13
2
11 100
Output:
Explanation:
- The first processor (with bounds 8 to 11) can execute all 3 processes, and the sum of powers is (11 + 11 + 11 = 33).
- The second processor (with bounds 13 to 100) cannot execute any of the processes since none of them lie within its range. Thus, its number of processes is 0 and power consumed is 0.