PimpedButterfly's blog

By PimpedButterfly, history, 18 months ago, In English

Hello, I wanted to know why the this submission was giving TLE. Thanks :)

  • Vote: I like it
  • 0
  • Vote: I do not like it

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

upper bound for sets works in linear time

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

    But even lower_bound is giving TLE. Does that also work in linear time?

    • »
      »
      »
      18 months ago, # ^ |
        Vote: I like it +9 Vote: I do not like it

      Yes, For set you have to use set lower_bound and upper_bound which works in O(logn) complexity.

      For an explanation refer this

      • »
        »
        »
        »
        18 months ago, # ^ |
          Vote: I like it +1 Vote: I do not like it

        Thank you so much, both of you, I did not know that. Now it got accepted