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.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
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 . 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:
Comments
A set do not "..sort the strings in alphabetical order..." automatically.... please revisit your explanation since it's wrong...
The editorial was referring to C++ sets, which do sort their elements in order. The editorial has been updated to say
std::set
instead ofset
to clarify this.But yes, if you are using Python, you will have to sort the strings after removing duplicates.