Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

MarioYC's blog

By MarioYC, 13 years ago, In English

Got AC, silly mistake =(

My approach works as follows:


  • For every operation, get all the sub-rectangles affected and save all these operations (function add)
  • Since M < 50, use grid compression
  • Count the number of 0's that there were initially in a sub-rectangle (function count), if the state of the bulbs changed add the number of 0's else add the number of 1's.
Code: http://pastie.org/2125732
  • Vote: I like it
  • +1
  • Vote: I do not like it