Jady's blog

By Jady, history, 4 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

»
4 years ago, hide # |
 
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; }

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

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

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