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

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

Hi Everyone,

I would like to ask all of you about the cause for this kind of strange behaviour of my code with respect to little change.

I have made submission to the following problem Rebuild (January Clash Contest). I have made the following submission at first link here and got following result.

I thought and checked for the possible reason of segmentation fault but could n't find one as everything was correct according to me then suddenly i made one small change and woohhhh amazingly it worked and the change was ..

I am still not convinced with whatever happened to me. After all what possible difference an "equal to" can cause in this case. Please explain ?

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

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

Auto comment: topic has been updated by NeverSayNever (previous revision, new revision, compare).

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

Its due to equal to sign in comparison function (probably for sorting). I also experienced the same issue in the recent Codechef contest and took like 10 submissions to find the cause. Here it is explained: http://stackoverflow.com/questions/2385690/sorting-only-using-the-less-than-operator-compared-to-a-trivalue-compare-functio