Yesterday's codeforces question

RPG protogonist question seemed very confusing. My doubt is that should we maximize units of hammers and swords combined or no. of weapons? and how do you do it? Any help is welcome.

we need to maximise number of weapons.

the approch is simple first we need to pick the weapon of minimum weight(say swords) then assign
master assistant
0 cnt
1 cnt-1
2 cnt-2
…and so on
cnt means (count of weapon with minimum weight)
then fill the remaining elements in the empty space left.
out of all cases above return where does the maximum exist.

1 Like

Go from 0 to the number of swords.

In each iteration. You try to take i swords and if you can’t all swords then give remaining to your follower.

Now, take as much as axes you and your follower can with remaining weight capacities.

Find the maximum answer from all of them,

My Implemention

And what do you mean by

isn’t units of hammers and swords combined == no. of weapons

1 Like

I just realised that :sweat_smile: understood the question now. thanku

1 Like