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 :)
Your comparator is wrong in a case where
c.ss < n.ss
andc.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 thisbool cmp(pair<string, int> c, pair<string, int> n){ if(c.ss != n.ss) return c.ss > n.ss; return c.ff < n.ff; }
c.ss != n.ss
is my default from now :) Thanks!https://codeforces.net/blog/entry/70237?f0a28=1
Maybe there is any point to somehow pin forever hints like that
LOL! Gotta write this 10 times in my notebook ;)