Please read the new rule regarding the restriction on the use of AI tools. ×

DPUYDV's blog

By DPUYDV, history, 14 months ago, In English

I was solving problem Buying gifts. I am getting wrong answer if I use ordered_multiset(pbds) submission link. If I use std::multiset instead of ordered_multiset than solution gets accepted submission link. Can somebody explain why and what am I doing wrong???

Note : Sorry for my bad English.

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

| Write comment?
»
14 months ago, # |
  Vote: I like it +3 Vote: I do not like it

ordered set with less_equals doesnt work well, it's not meant to be used like this. If you want it to act like a multiset with the special order functions, then use it with pair<int,int> where the first value is the number and the second is a unique index, and then a normal less<> comparator will work well

  • »
    »
    14 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it
    **ordered_set with less_equals doesn't work well**
    

    means is this any internal problem of pbds? can you provide any link of documentation or tutorial or more deep understanding.

    I am still confused why this happens ??