Eddagdeg's blog

By Eddagdeg, history, 2 years ago, In English

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

 
 
 
 
  • Vote: I like it
  • -11
  • Vote: I do not like it

»
2 years ago, # |
  Vote: I like it +11 Vote: I do not like it

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

»
2 years ago, # |
  Vote: I like it +8 Vote: I do not like it

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?

  • »
    »
    2 years ago, # ^ |
      Vote: I like it +9 Vote: I do not like it

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