ASSIGN O(N^2 * 2^N) Solution

TLE in SPOJ