Function to return the maximum cost
def answer ( a , n ) : NEW_LINE INDENT dp = [ [ 0 for i in range ( size ) ] for j in range ( size ) ] ; NEW_LINE for i in range ( size ) : NEW_LINE INDENT for j in range ( size ) : NEW_LINE INDENT dp [ i ] [ j ] = - 1 ; NEW_LINE DEDENT DEDENT DEDENT