Блог пользователя sasamba_bitches

Автор sasamba_bitches, история, 4 года назад, По-английски

I have already seen editorial, but getting WA. Here is the problem and this is my code. Can you please help me?

Thanks!

  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

In the function "thir" you can't write

auto it = s.lower_bound(x);
it--;

because maybe it == s.begin(). Instead of "it--" you can do "k--".

Also you should check that it != s.end(), before you do "it++" in the for loop.

And since the for loop might not be entered, you should also check that it != s.end() before you return *it in the end.