nikhilesh-03's blog

By nikhilesh-03, history, 4 hours ago, In English

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

  • Vote: I like it
  • +5
  • Vote: I do not like it

»
4 hours ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks a lot man its worked.

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

    • »
      »
      »
      4 hours ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it
      • »
        »
        »
        »
        4 hours ago, # ^ |
        Rev. 2   Vote: I like it +5 Vote: I do not like it

        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