wozszym's blog

By wozszym, history, 9 years ago, In English

Hi, I've got a problem with this task: Points on Plane. I 've got RTE on test 14. Can anybody tell me what could by wrong? Here is my code: code

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

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

When you call std::sort with a custom comparison function (cmpdec and compinc in your case), a number of assumptions are made on that comparison function (it should be a "strict weak ordering"). In particular, it shouldn't be possible that compinc(a,b) and compinc(b,a) both return true. But it is possible, so you get RTE. You should be able to fix this by changing "<=" to "<".