SEATL - Editorial

I think these will be available soon, my code is at CodeChef: Practical coding for everyone

Its written that sum of n*m <= 10^6 over all test cases, which means that ‘t’ should’ve been fairly large in smaller subtasks :stuck_out_tongue:

1 Like

i think inserting in multiset would be taking larger time. Think for the case when all numbers are distinct and N*M is 10^6. This happened with me when i was using set.

1 Like

Note I mentioned O(NM), so within a constant factor of N*M).
The key is that the more times a row/column is best for a specific number, the less distinct numbers we have. While in your example both 1 and 2 have 4 options for each row/column, there are only 2 numbers to consider.

Oh okay that is true! Thanks :smiley:

Your link says “Access Denied.” This link is the real link to your solution. Also, I might be wrong, but I do not think you are accounting for the case where you need to subtract 1 because the row and column have the number in question at its intersection.

No, j processes columns and i the rows.