Блог пользователя nikhilesh-03

Автор nikhilesh-03, история, 7 часов назад, По-английски

Can anybody help me why this code is giving runtime error on 5th test case for this Question: https://codeforces.me/problemset/problem/1839/B Submission: https://codeforces.me/contest/1839/submission/305001682

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

»
7 часов назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

In the comparator, you need to replace return a.second >= b.second; by return a.second > b.second;

Comparator should return false if its arguments are equal

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

    Thanks a lot man its worked.

    Can you please tell why >= causes instability in my result ?

    • »
      »
      »
      7 часов назад, # ^ |
      Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится
      • »
        »
        »
        »
        7 часов назад, # ^ |
        Rev. 2   Проголосовать: нравится +5 Проголосовать: не нравится

        Thanks a lot bro, now I got it. It was really really helpful

        sort function uses < operator and lets suppose we are comparing 5 < 5 then it should return false whereas mine was giving as true, that's where its fucked up, right