c++ sort() vs stable_sort(), WA

Revision en1, by Fred_Flintstone, 2017-08-27 14:37:52

Hi codeforces!

I was solving this problem: 100685J - Just Another Disney Problem and I solved it using c++ sort() (submission: 29823860), however I got WA and I was very confused as to why. Later I tried the same but using stable_sort() (submission: 29824442) and surprisingly I got AC. In the statement it says that "for every two of them he likes one of them more than another one" meaning that they have each different "beauty", thus stability is useless. I'd be very grateful if someone could explain me why my first submission failed, it's driving me crazy, I even wrote my first blog because of that!!!

Tags sort, stable_sort, c++, wrong answer, help, explain


  Rev. Lang. By When Δ Comment
en1 English Fred_Flintstone 2017-08-27 14:37:52 650 Initial revision (published)