Hi,
I have tried solving this problem with matrix exponentiation, on hackerblocks , I get one wrong answer for the following test case:
12 25
1000
1000000
99834332
9845323321
85633432
20003332
344223
908
32
21
44
9874342
and on spoj , I get a TLE after passing something like 14 testcases.
Here’s the link to my code: https://ide.codingblocks.com/s/72363
Please help me figure out what I am doing wrong. Thanks