AgodaOA #1
Maximize Sum of Processed Times
估计中等评测数据准备中,可先阅读题面
考点(AI 标注)树形博弈
There is a dual core processor with one queue for each core. There are n processes, where the time to complete the i-th process is denoted by time[i] (0 ≤ i < n). One core holds a "latch" at any moment. When assigning the i-th process, the holder of the latch picks one of two operations:
- The i-th process is assigned to the core c (latch holder), and the latch is given to the other core.
- The i-th process is assigned to the other core, and the latch is retained by 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 (i)th 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.
Return the sum of time taken by the first process and the second process i.e. S1 and S2 in an array.
Function Description
Complete the function
maximizeSumOfProcessedTimesin the editor.maximizeSumOfProcessedTimeshas the following parameter: int[] time: an array of integers representing the time to complete each process Returnsint[]: an array of two integers representing the sum of time taken by the first and second process respectively