A question on matrix exponentiation

Revision en1, by innoshark, 2020-03-13 23:08:29

Hello, I was just attempting this questionhere and solved it by writing out this code here. However, my original thoughts on this question, were to write out a normal dp and then optimize it using matrix exponentiation, and then do binary search on all values of n. However, I got confused and I did not know how to do the optimization. Can someone please explain to me how this could be done?

Tags #matrix exponentialtion, #dp, #combinatorics, #binary search, #modular exponentiation

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English innoshark 2020-03-13 23:08:29 536 Initial revision (published)