Блог пользователя wozszym

Автор wozszym, история, 9 лет назад, По-английски

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

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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 "<".