Woburn Challenge 2018-19 Round 3 - Senior Division
Jessie, James, and Meowth, members of the honourable Team Rocket, have
finally hit the jackpot! They've managed to steal a group of
What remains is for Team Rocket to make the best use of their haul. They
can't necessarily afford to carry around that many Pokémon with them, so
they'd like to choose exactly
Subject to those conditions, help Team Rocket determine the maximum sum
of Pokémon levels which such a team could possibly have! Please note
that the answer may not fit within a
Subtasks
In test cases worth
Input Specification
The first line of input consists of three space-separated integers,
Output Specification
Output a single integer, the maximum sum of Pokémon levels which a valid
team of
Sample Input 1
5 3 3
1 8
2 5
1 13
3 5
2 4
Sample Output 1
23
Sample Input 2
7 5 2
1 11
2 10
1 16
2 11
1 19
1 7
2 15
Sample Output 2
72
Sample Explanation
In the first case, the
In the second case, the
Comments