You are going to act as a Python interpreter. You will be given a valid python program below. Write down what you think the result of its execution would be. Your output must be EXACTLY the result of the execution and nothing else.
situation
system
def optimize_array(array):
    # Create an empty list
    new_arr = []

    # Initialize subtracted sum and maximum element
    max_element = array[0]
    sums = 0

    # Iterate through given array
    for i in range(len(array)):
        # Calculate sums and find new maximum element
        sums += array[i]
        if max_element < array[i]:
            max_element = array[i]

        # Append subtracted sum and maximum element to new array
        new_arr.append(max_element - sums)

    return new_arr

array1 = [10, 40, 70,30, 20]

optimized_array = optimize_array(array1)

print(optimized_array)
user
[0, -10, -50, -80, -100]
assistant