Please, try EDU on Codeforces! New educational section with videos, subtitles, texts, and problems. ×

GLAYS's blog

By GLAYS, 4 weeks ago, In English,


Here is the PDF statements page of the 2016 Benelux Algorithm Programming Contest (BAPC 16).

I reduced Problem H with some small observations to this problem:


Since I believe there isn't another(totally different) way to solve it and to keep this short, I won't explain how I got to that statement from Problem H.

Now this seems to me like a 100% greedy problem. But I ALWAYS get stuck in this same type of problems, I just can't find any way to distribute them. Maybe the small constraints on the number of primes should help?

The only algorithm I know in some similar cases to this is the Huffman Code and I don't think it can help here. (maybe some variant of it can?)

Can you help me solve this? Also it would be awesome if you would provide any help/links on some problems/tricks to help with such greedies!

Thank you :)

  • Vote: I like it
  • +7
  • Vote: I do not like it