For technical reasons, judging has been temporarily stopped. No estimates yet. We are sorry for the issue. ×

adityachad's blog

By adityachad, history, 3 weeks ago, In English

I was solving the E problem from this Codeforces Round 950 (Div. 3) named E.Permutation of Rows and Columns, and came up with the following approach:-

Since the shifting is by rows and columns only, that means the elements that were in the same column will remain in the same column, and all elements in the same row will stay in the same, ordering within might be different in both cases but the composition will always be same so I implemented this by the following.

I took each row of the given original matrix sorted that and appended it to a vectorA, similarly took each column of that original matrix sorted that, and appended it to the same vectorA, at the end I sorted this vectorA also. Did the exact thing for the matrix in which to achieve, took rows, sorted them appended them, same for columns into a vectorB In the end, I just compared both vectorA and vectorB and gave the verdict that if same then "YES" else "NO". My Submission

Can anyone tell where I am wrong, In thinking about the approach or implementation or if I just totally misunderstood the problem?

Thanks for helping :) !

  • Vote: I like it
  • +5
  • Vote: I do not like it

»
3 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it
Here is a testcase where it will fail
Here is another
Reason Why?
  • »
    »
    3 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks for helping, I didn't really thought well through that approach, understood the mistake.