Editorial for DMOPC '15 Contest 1 P2 - Itami and Squad
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:
To simulate each squad leader picking the best available soldier, sort the strengths of the soldiers in non-increasing order. We then iterate through the array starting with soldier (in a -index array) and increment by , adding their respective strengths will result in the maximum strength of Itami's squad.
Time Complexity:
Comments