Помогите с задачкой. Python

Задача

Пробовал:

def calculate_areas(w, h,  n, m, k,  x_coords, y_coords):
    list_k = []
    x_coords = [0] + x_coords + [w]
    y_coords = [0] + y_coords + [h]
    widths = [x_coords[i] - x_coords[i-1] for i in range(1, len(x_coords))]
    heights = [y_coords[i] - y_coords[i-1] for i in range(1, len(y_coords))]
    areas = [w * h for w in widths for h in heights]
    areas.sort(reverse= True)
    return areas[k - 1], areas[0]
 
w, h = map(int, input().split())
n, m = map(int, input().split())
k = int(input())
x_coords = list(map(int, input().split())) if n > 0 else []
y_coords = list(map(int, input().split())) if m > 0 else []
print(*calculate_areas(w, h, n, m, k, x_coords, y_coords), sep=' ')

Ошибка: 'Ошибка выполнения'


Ответы (0 шт):