Player i has score scores[i] and age ages[i]. Choose a group of players with the largest possible sum of scores. A group is invalid if a younger player has a strictly higher score than an older player in that group. Players of the same age never conflict, and equal scores do not create a conflict. Return the maximum score sum of a valid group.
Example 1:
Input: scores = [5,2,4]
ages = [2,2,2]
Output: 11Explanation: All three players have the same age, so their different scores do not create conflicts. Select everyone for a total of 5 + 2 + 4 = 11.
Example 2:
Input: scores = [9,4]
ages = [1,2]
Output: 9Explanation: The younger player scores 9, which exceeds the older player's score of 4. They cannot both be selected, so choose the player scoring 9.
Example 3:
Input: scores = [3,3,3]
ages = [3,1,2]
Output: 9Explanation: All scores are equal, so no younger player scores strictly more than an older player. Select all three for a total of 9.
Constraints:
1 <= scores.length <= 1000scores.length == ages.length1 <= scores[i] <= 10000001 <= ages[i] <= 1000