You are an administrator of a society “Happy Colony”. You have a mxn matrix and are given the job of assigning houses to society members, where each cell repressents a house.Each member is of two kinds : either an Introvert or an Extrovert. Introverts do not like having neighbors. Their happiness zaps down by 30 points for every wall that they share with someone (could be either introvert or extrovert).
Extroverts love having neighbors. Their hapiness boosts by 20 points for every wall they share with someone(introvert or extrovert). There can be at most 4 neighbors( corresponding to the 4 sides of cells or houses ).Extroverts start with a happiness point of 40, while introverts start with happiness points of 120.Given values of m,n and the number of introverts and extroverts, find the maximum happiness points you can gain.
1 <= m,n <= 10 and 0 <= I,E <= 10
Test 1: m = 1, n=1,I =1, E=0.
Test 2 : m=2, n=3, I=1, E=2.
Test 1 : 120
Test 2 : 240