sasamba_bitches's blog

By sasamba_bitches, history, 20 months ago, In English

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

Thanks!

  • Vote: I like it
  • +8
  • Vote: I do not like it

»
20 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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.

  • »
    »
    20 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It did not help.

    code

    • »
      »
      »
      20 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Check if "it == s.end()" before you increase it.

      Spoiler