Limits
1s, 64 MB

**—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:

$Mentioned$ $that$ $:$ $Redeemed$ $Points$ $Are$ $Fixed.$

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 $N$ 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 $Tag_i$ (consist of uppercase Latin alphabet and underscore) and an integer $P_i$ — indicates the activity tag and the redeem points for the activity tag.

Next line of the test case contains a single integer $N$ — indicates the number of activity.

Next $N$ 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).

$1≤N≤100$

$1≤|Tag_i|≤20$

$1≤P_i≤100$

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 |

In the first example, CONTEST_HOSTED + CLASS_TOOK + TOP_CONTRIBUTOR + CONTEST_HOSTED + CONTEST_WON + BLUE_CHAMPION + CONTEST_WON $85 + 75 + 100 + 85 + 90 + 98 + 90$ $Total points = 623$
After taking $6$ XXL-sized KitKats, the remaining points are $83,$ which is insufficient for one more XXL-sized KitKat. Then, after taking $2$ XL-sized KitKats, the remaining points are $23,$ which is also insufficient for one more XL-sized KitKat. Finally, he can only take $2$ L-sized KitKats, leaving $3$ 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 |

Login to submit.

97%
Solution Ratio

iffatul_anonEarliest,

user.9605Fastest, 0.0s

iffatul_anonLightest, 4.9 MB

user.8060Shortest, 462B

Toph uses cookies. By continuing you agree to our Cookie Policy.