how to use matrix exponentiation in this problem ? ( help required in speeding up solution )

Revision en2, by arun_prasad, 2017-02-01 06:12:56

ive been trying to solve this problem since yesterday night . however i could only come up with an O(d*d*k) solution.

problem

this however wont work due to Memory and time limits.

I also looked at one of the solved solutions by rajat1603 solution link

Could someone explain how matrix exponentiation could be used in these type of problems ?

help would be greatly appreciated :D

Tags matrix exponentiation, dp, help needed

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English arun_prasad 2017-02-01 06:12:56 57
en1 English arun_prasad 2017-02-01 06:12:23 547 Initial revision (published)