tenshi_kanade's blog

By tenshi_kanade, history, 9 years ago, In English

I experienced a strange WA on 576C - Точки на плоскости.

Compare these two submissions: 13000332 and 13000388. They are exactly the same, except that one submission had comparators <= and >=, while the other had comparators < and >. There shouldn't be any undefined behaviour as far as I can see, so I'm wondering why the WA in the first submission.

This would have been very frustrating had it been during a contest... Is there anything I'm missing here?

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

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

http://en.cppreference.com/w/cpp/algorithm/sort

Compare must meet the requirements of Compare.

http://en.cppreference.com/w/cpp/concept/Compare

If comp(a,b)==true then comp(b,a)==false