ADANUM — Ada and Numbering[SPOJ] Need help

Revision en1, by MohamedSameh, 2020-05-01 01:17:22

Peace on you code forces Community

Currently, I'm trying to solve this problem.

I think the solution is a standard Mo algorithm,

I think the minimum cost will be to give the highest frequency value = 1 and the next highest frequency value = 2 and so on,

but How to compute the answer for each query,

I have tried to store each frequency in a set and for each frequency store the number it repeated but it gives TLE in test 15, I also see some code in git hub but I didn't understand what he is doing.

can you help, thank you.

Tags mo algorithm

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English MohamedSameh 2020-05-01 01:17:22 632 Initial revision (published)