How do I optimize my Mo's algorithm solution?

Revision en3, by coco_elon, 2017-06-03 10:24:25

This is my solution for 86D : Powerful Array. Link: http://ideone.com/618TcS

This gave me a TLE at test 6, taking more than 5000 ms whereas most AC solutions pass at 800 — 1000 ms. How do I optimize my code? Thanks in advance!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English coco_elon 2017-06-03 12:32:06 1147 Reverted to en3
en4 English coco_elon 2017-06-03 12:32:00 1147 Reverted to en2
en3 English coco_elon 2017-06-03 10:24:25 1147
en2 English coco_elon 2017-06-03 10:22:02 36
en1 English coco_elon 2017-06-03 10:19:22 1351 Initial revision (published)