Strange matrix


Strange Matrix
i tried but couldn’t solve it
after looking solutions the answer was the gcd of the order of matrix

can anyone explain how everyone have come to conclusion that the solution will be the gcd of order(n,m)
please help me

1 Like

Read its editorial. Explanation lies there in a perfect manner.

link - http://discuss.codechef.com/questions/24629/rrmatrix-editorial

1 Like