Editorial for New Year's '17 P4 - Christmas Cozonac
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Store the initial recipes in a map using a sorted list and a string. When you are reading the recipes to convert, use a stack of sorted lists.
Time Complexity: , where is the number of ingredients in the recipe.
Comments
map<vector,string> is enough.
I'll change it to say "sorted list".