Editorial for BSSPC '22 P6 - Permutations & Primogems
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Subtask 1
If we're going to buy all the characters, it is optimal to buy them in order of non-increasing
Subtask 2
Knowing that the best ordering is non-increasing
Now, since we're not buying every character, and it's not trivial to determine which characters should be bought and which shouldn't, let's do DP.
Specifically, our state is
Comments