I am using matrix exponential for this ques but it is not working for N>=1000 as time complexity for matrix expo is N^3logT hence TLE is coming can u please suggest how to deal with this kind of question
MY CODE FOR MATRIX EXPO APPROACH =>https://ide.codingblocks.com/s/243873