How can I improve CF364 Div2B

Revision en2, by reclusion, 2016-07-23 22:21:55

Here's my code : http://pastebin.com/WPfr9ZX4

Initially all columns and rows have N items each. After item is placed on the grid I subtract 1 from all the columns and rows and update the result accordingly. On test 7 I get TLE. How can I make this faster?

My submission : http://mirror.codeforces.com/contest/701/submission/19371051

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English reclusion 2016-07-23 22:21:55 78
en1 English reclusion 2016-07-23 22:20:10 288 Initial revision (published)