Difference between S.lower_bound(key) and lower_bound(S.begin(),S.end(),key)

Revision en2, by techwiz911, 2015-07-02 23:31:01

I was attempting the following question 310D

Here is my submission that timed-out TLE

And here is my submission that was accepted AC

As you may have observed, the only change I made from the TLE code to AC code was

  it=lower_bound(s.begin(),s.end(),mp(lo,o));

to

  it=s.lower_bound(mp(lo,o));

where "it" is a set iterator.

Just changing this, the time on Test #11 was reduced from >3000ms to 264ms. Can any one shed some light on why this happened? Thank you.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English techwiz911 2015-07-02 23:31:01 33 Tiny change: 'n~~~~~\n\nJust c' -> 'n~~~~~\n\nwhere "it" is a set iterator.\n\nJust c'
en1 English techwiz911 2015-07-02 23:23:28 734 Initial revision (published)