Editorial for 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.

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: \mathcal{O}((N + C)R \log R), where R is the number of ingredients in the recipe.


Comments


  • 0
    rameshaggarwal  commented on Jan. 3, 2017, 1:40 a.m.

    map<vector,string> is enough.


    • 0
      Kirito  commented on Jan. 3, 2017, 9:59 a.m.

      I'll change it to say "sorted list".