TLE in 1 Test Case

I got the idea of dimension compression (4D -> 3D) but I am unable to get the transitions. Code URL : https://pastebin.com/Zc27bCXm

Hey @zanj0
Just think of it this way
for each 1<=i<=n there are n1*n2 possible states
that way you can write the compressions maybe

Hey. I understood the fact that there will be b + g = N as one of the dimension and n1, n2 as the second and third dimensions respectively so the total time complexity will be n^3 but I am unable to implement it. Please help me in implementing it.

@zanj0

Thanks a lot for the help! :slight_smile:

1 Like

@zanj0
If your doubt is resolved please close it

I have already closed it.

1 Like