Efficient Deployments
A supercomputer has several processors to deploy for execution. They are arranged sequentially in a row from 1 to n. The efficiency of each processor depends upon the order of deployment of its adjacent processors.
For the i th processor, the efficiency of the i th processor is no_adjacent[i], one_adjacent[i], or both_adjacent[i] when neither, one, or both adjacent processors are deployed before processor i.
Note: The 1st and n th processors can only have one adjacent.
Find the maximum possible sum of efficiencies amongst all possible orders of deployment.
Complete the function getMaximumSum in the editor.
getMaximumSum has the following parameters:
- 1.
int no_adjacent[n]: an array of integers - 2.
int one_adjacent[n]: an array of integers - 3.
int both_adjacent[n]: an array of integers
Returns
long integer: the maximum possible sum of efficiencies
࣪𓏲ּ ᥫ᭡ Credit to Defthobo 🌟𓂃
1Example 1
Constraints
Limits and guarantees your solution can rely on.
- 2 <= n <= 10^5
- 1 <= no_adjacent[i], one_adjacent[i], both_adjacent[i] <=10^9