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 allower_bound from the set STL)
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!