Solve in Python.  

Question 3:

There is a dual-core processor with one process queue for each core. There are n processes, where the time to process the ith process is denoted by time[i] (1 ≤ i ≤ n). There is a latch that helps decide which process is processed by which core. Initially, the first core has the latch. Suppose the latch is currently with the cth core, where c is either 1 or 2, and the ith process needs to be assigned. Then one of the following operations must be performed:

- The ith process is assigned to the core c and the latch is given to the other core.
- The ith process is assigned to the other core, and the latch is retained by the core c.

The aim of each core is to have a maximum sum of time of processes with them for better performance. So, while assigning the ith process, the core with the latch decides the operation to be performed such that the total sum of time of processes assigned to it is maximized after all the processes are assigned.

Find the sum of the time of processes assigned to the first and second cores if both the cores work optimally. Return an array of two integers, where the first integer is the sum of the time of processes assigned to the first core, and the second integer is the sum of the time of processes assigned to the second core.

Example:
Given n = 5 and time = [10, 21, 10, 21, 10]:

Let's have an assignment as follows:

| Latch | Time | Assigned Core | New Latch |
|-------|------|---------------|-----------|
| 1     | 10   | 2nd           | 1         |
| 1     | 21   | 1st           | 2         |
| 2     | 10   | 1st           | 2         |
| 2     | 21   | 1st           | 2         |
| 2     | 10   | 2nd           | 1         |

Hence, the total time of processes for the first core is (21 + 10 + 21) = 52, and the total time of processes for the second core is (10 + 10) = 20. The given assignment is not optimal as for the 4th process, the 2nd core assigned the process with process time = 21 to core 1, and got the 5th process with process time = 10, which is not an optimal move by core 2. The optimal move by the 2nd core would have been to assign the 4th process to itself and the 5th process to core 1; this would have given the total process time to the 2nd core = 31, which is better than 20.

An optimal assignment is shown:

| Latch | Time | Assigned Core | New Latch |
|-------|------|---------------|-----------|
| 1     | 10   | 2nd           | 1         |
| 1     | 21   | 1st           | 2         |
| 2     | 10   | 1st           | 2         |
| 2     | 21   | 2nd           | 1         |
| 1     | 10   | 1st           | 2         |

Hence, the total time of processes for the first core is (10 + 21 + 10) = 41, and the total time of processes for the second core is (10 + 21) = 31.

Return the answer array, [41, 31].   
Function Description:
Complete the function getProcessTime in the editor below.

getProcessTime has the following parameter:
    int time[n]: the processing time required for each process

Returns:
    long[2]: the sums of the processing times of the first and second cores

Constraints:
• 1 ≤ n ≤ 10^5
• 1 ≤ time[i] ≤ 10^9

Input Format For Custom Testing:
Sample Case 0

Sample Input For Custom Testing:
STDIN       FUNCTION
-----       --------
4       →   time[] size n = 4
10      →   time = [10, 10, 10, 10]
10
10
10

Sample Output:
20
20

Explanation:
One optimal assignment is:

| Latch | Time | Assigned Core | New Latch |
|-------|------|---------------|-----------|
| 1     | 10   | 1st           | 2         |
| 2     | 10   | 2nd           | 1         |
| 1     | 10   | 1st           | 2         |
| 2     | 10   | 2nd           | 1         |

The total time of processes for both cores is 20.