Maybe This will help? I haven’t fully explained it, so if you don’t understand than ask.
You can refer to my code, also what do u mean by how matrix equation is formed?
got this thanks
Does solution which does not use bitset pass all cases? I mean in the contest discussion video I saw the person said that its essential to use bitsets to lower the constant factors by 64 or so. Also I need to learn to use these bitsets.
I tried that first. Tles by a lot ~30 seconds needed.