I was solving 1684D - Traps of recent contest and have faced with strange thing.
Pls look at two pairs of submissions. (There are very simple code)
In both pairs codes' difference is the same: 'wrong' submission uses lambda function with operator >=
instead of >
in 'good' submission.
Can it be explained?
i suppose (i'm not sure of course), that sorting with operator >= is bad because comparator can swap equal elements infinitely (sounds a bit crazy, but seems like there are not other reasons for RE and TL)
https://codeforces.net/blog/entry/70237
Thank you.
if comparator returns true for (a, b) it should return false for (b, a). otherwise it's undefined behavior
Thank you.