You aren’t calling your check function recursively, due to which I think it gave WA for subtask 1. If you modify your check function, and call things recursively when assigning values, it should fix the issue. Luckily no such test case might be present in subtask 2 and 3, hence you survived them.
So, I bruteforced your solution with one AC solution (100 points) for all possible input of 3x3 and 2x2. It gave same results.
Hence, possible problem could surely be due to your while(t–), and it turned out my fluke was right, and upon initializing arr with 0 in your exact code, lead to AC.
yes this worked, but i still didn’t get what the problem really is, when I am considering n in all of the functions and the code is checking in that n x n matrix only O_O
Just to increase the feels, the SCHEDULE problem for this march long was like…well…we had an editorial of it right under our nose at the discussion forum XD