How matrix exponentiation works in this problem

Anybody pls explain

@anon55659401 @guitarlover @ssrivastava990

Problem Link : https://www.codechef.com/ENOC2019/problems/DEARRERR

How matrix exponentiation works in this problem

Anybody pls explain

@anon55659401 @guitarlover @ssrivastava990

Problem Link : https://www.codechef.com/ENOC2019/problems/DEARRERR

1 Like

read this blog. this will help u surely

as here u can make matrix like this

```
An 2 3 2 3 An-1
An-1 1 0 0 0 An-2
Bn = 0 0 2 3 Bn-1
Bn-1 0 0 1 0 Bn-2
```

2 Likes

Thanks a lot