UPDATE: The problem was found. It was that I should not have used the the generic lower_bound function from algorithm library (I should have used the specific lower_bound from the STL multiset)
Hello!
Regarding this problem, my code implements the same ideia from the following editorial and gets TLE.
Do you know what part of my code is too slow? In my point of view, the code is exacly equal the editorial.
Thanks a lot!