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

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

Hi everyone!. Im stuck with a bug in this problem. I tried to debug it, the code gets a runtime error in the cin>>buff line, when trying to get the last number (n=1999, and runtime error at i=1998). I will be glad if you can help me. Thanks!!!

My Submission: 123961933

Problem: 1546C — AquaMoon and Strange Sort

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

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

The comparison function of sort must be a strict order : It must return false when x = y. Replacing > with >= gives AC.

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

    WoW thanks mate!!. I still dont understand well. I put couts in the code to debug it, and i was sure that it stopped in the cin. That was incorrect? or was de comp function messing the things?. Other question, the sort function, swap items when the comp return true? or when return false? Im a bit confused with that. Have a nice day!