The PDF file of all problems can be downloaded HERE
2 2 3 001 111 3 3 001 011 000
Case 1: row 1 Case 2: both 2
Explanation of sample input and output:
Case 1
The initial matrix is:
001
111
If we swap values of cell (1, 1) and cell (2, 1), the matrix will become
101
011
Now each row has two 1s and we found the solution.
Case 2
The initial matrix is:
001
011
000
If we swap the values of cell (2, 1) and cell (2, 3) (Considering the matrix wraps), the matrix will become
001
110
000
If we swap the values of cell (2, 1) and cell (3, 1), the matrix will become.
001
010
100
Now each row has one 1 and each column has one 1 and we got our solution.
Migrated from old NTUJ.
Regional Dhaka 2011
No. | Testdata Range | Score |
---|