MohamedSameh's blog

By MohamedSameh, history, 4 years ago, In English

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.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it