Jady's blog

By Jady, history, 3 years ago, In English

Problem: Facetook Priority Wall

Accepted Solution: Accepted
Runtime error on test case 18: Runtime error

Only main difference between the two submission is of how we implement comparison. Thoughts?
ps: codeforces rookie here, please don't downvote me :)

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

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Your comparator is wrong in a case where c.ss < n.ss and c.ff = n.ff. In this case comparator will return that n = s but it isn't so. When we make a comparator we need to compare all properties of the objects we compare. For example the correct comparator for this case is looking like this bool cmp(pair<string, int> c, pair<string, int> n){ if(c.ss != n.ss) return c.ss > n.ss; return c.ff < n.ff; }

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    c.ss != n.ss is my default from now :) Thanks!

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

https://codeforces.net/blog/entry/70237?f0a28=1

Maybe there is any point to somehow pin forever hints like that

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    LOL! Gotta write this 10 times in my notebook ;)