Doubt About set Usage

Revision en2, by code_warrior, 2020-07-29 08:24:31

Hello,friends! Recently , i was solving a problem on data structures from codeforces Merge Equals. In this problem , i used a sorted list of pairs stored in a set. I wanted to get the second element just greater than or equal to a given element(a pair in this case) . For ,this i used lower_bound function to first get the required element and the incremented the iterator. But, unfortunately ,it gave me the wrong answer. But, when i just removed the element corresponding to iterator (before incrementing it) and the again used it=st.lower_bound({x,y}), it gave me the right answer. So, I want to ask why accessing a pair by incrementing iterator doesn't work in my case. If anyone can throw some light on the concerned issue, it would be highly beneficial for me and others too. Accepted Code Wrong Answer Code

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English code_warrior 2020-07-29 08:24:31 1 Tiny change: 'nt(a pair in this c' -> 'nt(a pair in this c'
en1 English code_warrior 2020-07-28 18:11:00 1003 Initial revision (published)