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

Getting TLE in MO's Algorithm with updates [SPOJ ADAUNIQ — Ada and Unique Vegetable]

Revision en2, by Tobby_And_Friends, 2017-10-31 21:20:51

Problem link: http://www.spoj.com/problems/ADAUNIQ/

My solution: https://ideone.com/srH91b

Verdict: TLE

How do I optimize my solution? Any help is really appreciated.

[Update] Got AC :) I missed out the fact that block sizes are of n^(2/3)

Tags mos_algorithm, datastructure

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Tobby_And_Friends 2017-10-31 21:20:51 78
en1 English Tobby_And_Friends 2017-10-31 20:23:34 259 Initial revision (published)