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

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

Hello CF community,While solving problem D New Year and Conferencefrom contest Hello 2020 ,I got runtime error in test 8 I tried some tests and I figured out that for some cases the problem is with my struct (some variables in my struct are huge random numbers and I cannot sort my vector of this struct while I'm sure that I'm setting every variable) here is link for my submission any help would be appreciated,and thanks

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

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

The problem is in the < operator.

It must be strict. Meaning it must be truly a '<' operator, which returns false for two equal elements. Otherwise using it can give RTEs because std::sort supposes that it's strict.

It's clear why since (x < x) = false. So just replace the two <= with <.

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

I just don't see the point in downvoting these type of posts!! If people can't answer or don't want to answer, why can't they just ignore it??!! What pleasure do they get by hitting the downvote button?

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

    it does not matter while there are some gentil and helpful people in this community