n players. Player i has skill skill[i] and stamina stamina[i]. You must form a team of exactly team_size distinct players.
The team's score is the total skill of its members multiplied by the smallest stamina among them: a team lasts only as long as its weakest member.
Return the highest possible score.skill=[5, 1, 4, 6], stamina=[3, 8, 2, 4], team_size=2 → 33
Players 0 and 3 give (5 + 6) · min(3, 4) = 33. Adding player 2 would drag the multiplier down to 2.
skill=[2, 9, 3], stamina=[10, 1, 10], team_size=1 → 30
Solo players score 20, 9 and 30, so player 2 is best.
skill=[3, 3, 3], stamina=[7, 0, 5], team_size=3 → 0
Everyone must play, and player 1 has stamina 0, so the score is 0.
skill=[5, 1, 4, 6], stamina=[3, 8, 2, 4], team_size=2
33
Run checks the first 3 tests in your browser. Submit checks all 117 tests on the server, hidden ones included.