How to solve this problem - https://codeforces.com/contest/1136/problem/C

I have looked after some codes, most them had this snippet x[i + j] = a*[j] and y[i + j] = b*[j];

But I couldn’t understand the logic behind it, anyone explain me.

# Codeforces Round - 546 - Div2C

**suraj_898**#1

You can observe that when you transpose a submatrix ,the effect will always upon the diagonal (all diagonal of that sub matrix and a part of diagonal of main matrix), Now here comes the cases of duplicate elements, now we can’t handle them (diagonal elements) using map so we will just sort them to compare with required matrix.A little bit observation

The logic behind it is to store the diagonal elements of the matrix, sort each of them and check for equality.