Final Exam - 07 December 2019 Group 2 - 03. Nikulden's meals
Здравейте колеги
Моля за съдейсвие Judge ми дава 80/100 - като 2 теста ми гърмят с ,,Лимит време,, : Моля ако някой вижда къде може да е грешката да съдейства:
Благодаря !
Код: https://pastebin.com/RNLqxvfh
Линк към Judge: https://judge.softuni.bg/Contests/Practice/Index/1929#2
Ето и условието на задачата:
Nikulden’s meals
Now you want to find out which meals your guests liked and how many meals they didn't like
Create a program that keeps information about guests liked and unliked meals.
You will be receiving lines with commands until you receive the "Stop" command. The possible commands are:
- "Like-{guest}-{mea1}":
- Add the {mea1} to the {guest}’s collection of meals.
- If the guest doesn't exist, add it to your record.
- If the guest already has the meal in his collection, don’t add it.
- "Unlike-{guest}-{meal}":
- Remove the meal of the given guest’s collection and print:
"{Guest} doesn't like the {meal}."
You must keep the count of unliked meals!
- If the guest doesn’t exist, print:
"{Guest} is not at the party."
- If the guest doesn’t have the meal at the like list, print:
"{Guest} doesn't have the {meal} in his/her collection."
In the end, you have to print the guests with their liked meals sorted in descending order by each guest meals count and then by their names in ascending order. Then print the count of unliked meals in the format below
{Guest1}: {meal1}, {meal2}, {meal3}
{Guest2}: {meal1}, {meal2}
...
Unliked meals: {count of all unliked meals}
Input
- You will be receiving lines until you receive the "Stop" command.
- The input will always be valid.
Output
- Print the guests with their meals in the format described above.
- Print the count of unliked meals in the format described above.
Examples
Input |
Output |
Like-Krisi-shrimps Like-Krisi-soup Like-Misho-salad Like-Pena-dessert Stop |
Krisi: shrimps, soup Misho: salad Pena: dessert Unliked meals: 0 |
Input |
Output |
Like-Krisi-shrimps Unlike-Vili-carp Unlike-Krisi-salad Unlike-Krisi-shrimps Stop |
Vili is not at the party. Krisi doesn't have the salad in his/her collection. Krisi doesn't like the shrimps. Krisi: Unliked meals: 1 |
Благодаря колега !!