Editorial for MALD Contest 1 P1 - Scratch Cat and DDoS


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.

Author: dawangk

This is an implementation problem. For each URL, check if it contains the substring yubo. You can implement your own substring search or use built-in substring search methods. Due to the small constraints, there is no need for substring search algorithms; you can simply check all substrings of size 4. If the current URL contains yubo, insert it and all adjacent elements into a C++ std::set, which can automatically remove duplicates and sort the strings in alphabetical order. Finally, output the elements in the std::set.

Complexity: \mathcal O(N \log N \cdot \max |s_i|)


Comments


  • -4
    InfinityAtEnd  commented on Sept. 17, 2022, 10:29 a.m.

    A set do not "..sort the strings in alphabetical order..." automatically.... please revisit your explanation since it's wrong...


    • 1
      BalintR  commented on Sept. 17, 2022, 3:04 p.m.

      The editorial was referring to C++ sets, which do sort their elements in order. The editorial has been updated to say std::set instead of set to clarify this.

      But yes, if you are using Python, you will have to sort the strings after removing duplicates.