• + 0 comments

    function Max(AA){ let maxc = AA[0]; for(let k=0;k

    return ret;
    

    }

    function solve(A) { // Return the sum of S(S(A var m = 1000000007; var res = 0; var Max_A_i_j = Max(A); var total = Max(A); var sum = Sum(A); var B = A; var A_i_j = []; var slice = A; var j = A.length ; var e_idx = 0; A_i_j = A.slice(0,j-1); B = Append(B,A_i_j); B = Append(B,[Max(B)]); B = Append(B,A_i_j); B = Append(B,[Max(B)]); console.log("-----------------------------------") console.log("i j k A[i,j] Max[A[i,j]") console.log("-----------------------------------") for(let k=0;k //total+= Max(Max_A_i_j); }else{ Max_A_i_j = Max(A_i_j); B = Append(B,A_i_j); console.log(i," ",j," ",k," ",A_i_j," ",Max_A_i_j); total += Max_A_i_j;
    sum = Sum(B);

                }
    
    
            }
    
        }
    }
    console.log(B,total,sum);
    console.log("-----------------------------------")
    return sum;
    

    }