You are given four integers m, n, introvertsCount, and extrovertsCount. You have an m $ imes$ n grid, and there are two types of people: introverts and extroverts. There are at most introvertsCount introverts and extrovertsCount extroverts available to be placed on the grid.
You may place at most one person in each cell of the grid, or leave the cell empty. You do not need to place everyone.
The happiness of each person on the grid is determined as follows:
An introvert starts with
An extrovert starts with
The total grid happiness is the sum of the happiness of all individuals placed on the grid.
Return the maximum possible grid happiness.
Constraints:
m, n
introvertsCount, extrovertsCount m $ imes$ n,
You are given four integers m, n, introvertsCount, and extrovertsCount. You have an m $ imes$ n grid, and there are two types of people: introverts and extroverts. There are at most introvertsCount introverts and extrovertsCount extroverts available to be placed on the grid.
You may place at most one person in each cell of the grid, or leave the cell empty. You do not need to place everyone.
The happiness of each person on the grid is determined as follows:
An introvert starts with
An extrovert starts with
The total grid happiness is the sum of the happiness of all individuals placed on the grid.
Return the maximum possible grid happiness.
Constraints:
m, n
introvertsCount, extrovertsCount m $ imes$ n,