—You might have heard about our programmer’s meetup program aka the "Chocolate Distribution". Let’s think about chocolate distribution criteria in an actual way.
In this program, we will be distributing chocolates for your winning contest and various other activities (described below), that you perform.
Let’s know about some amazing activities and their activity tags for getting chocolates in the meetup:
Let’s know about the KitKat chocolate's size and required redeem points for each size:
Since only programmers attend these meetups, chocolate distribution is done mathematically because they love math. The criteria for chocolate distribution is quite strict. The primary objective for programmers is to maximize the number of XXL-sized KitKats they can acquire by the using the redeem points they have. After acquiring maximum XXL-sized KitKat’s they can, their next priority is to obtain as many XL-sized KitKats as possible by their remaining redeem points and so on.
Recently, ChatGPT, a language model developed by OpenAI, has gained significant popularity due to its impressive problem-solving abilities. Therefore, you have decided to test ChatGPT's problem-solving skills by providing a problem scenario and input constraints, and asking ChatGPT to solve the problem. Now, you want to verify whether the solution provided by ChatGPT is correct or not. To do so, you will attempt to solve the problem independently and then compare your solution to the solution provided by the AI.
Firstly, you will be given five activity tags and the points received for each activity. Secondly, you will be given all activities completed by you. You have to calculate and print the KitKat size and the quantity that can be redeemed based on the redeem points you have.
The first five lines of the test case contains five pairs of input. Each line contains a string (consist of uppercase Latin alphabet and underscore) and an integer — indicates the activity tag and the redeem points for the activity tag.
Next line of the test case contains a single integer — indicates the number of activity.
Next line contains a single string — indicates the activity tag done by you (it is guaranteed that these string will be one of five activity tag).
Check sample input for further clarification.
Print three lines for the test case. Each line contains a pair of output consist of a string and an integer — indicates size of the chocolate and the total number of chocolate you can get using the redeem points you have.
Check sample output for further clarification.
Input | Output |
---|---|
CONTEST_WON 90 BLUE_CHAMPION 98 CONTEST_HOSTED 85 CLASS_TOOK 75 TOP_CONTRIBUTOR 100 7 CONTEST_HOSTED CLASS_TOOK TOP_CONTRIBUTOR CONTEST_HOSTED CONTEST_WON BLUE_CHAMPION CONTEST_WON | XXL 6 XL 2 L 2 |
Explanation: In the first example,
After taking XXL-sized KitKats, the remaining points are which is insufficient for one more XXL-sized KitKat. Then, after taking XL-sized KitKats, the remaining points are which is also insufficient for one more XL-sized KitKat. Finally, he can only take L-sized KitKats, leaving points unused, which cannot be used to obtain any additional KitKats. |
Input | Output |
---|---|
CONTEST_WON 30 BLUE_CHAMPION 20 CONTEST_HOSTED 20 CLASS_TOOK 10 TOP_CONTRIBUTOR 10 4 CONTEST_HOSTED CONTEST_WON CLASS_TOOK CONTEST_WON | XXL 1 XL 0 L 0 |