Sort 504 Discussions, By:
Please Login in order to post a comment
As far my knowledge , I cannot find any greedy pattern here. Greedy solution is to pick the optimal solution at that point. Correct me if I am wrong.
Isn't it that the given grid should be a square grid ? , but there are test cases where the grid is not a square matrice. E.g in test case 1:
Test cases contain mixed end of lines, sometime there is "\r" in the end, sometime there is none. Had to spend hackos to find this. Please fix the test cases (at least case#4).
I solved the problem. I'm getting all right except the test case 10. I checked the results by running on my computer and compared with the actual results. It is right as well, but it is showing wrong answer.
can you please let me know why ?
for i in range(n):
grid[i] = sorted(grid[i])
for i in range(n-1):
for j in range(n):
if __name__ == "__main__":
t = int(raw_input().strip())
for _ in range(t):
n = int(raw_input().strip())
grid = 
grid_i = 0
for grid_i in xrange(n):
grid_t = str(raw_input().strip())