Advertisement
chaotic_iak

TCO 2014 Round 1B (Almost) One-liner Solution in Python

Apr 19th, 2014
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. """
  2. TCO 2014 Round 1B (Almost) One-liner Solution in Python
  3. Although I'm sure this is absolutely unreadable at a glance, don't read further if you want to do it yourself.
  4. """
  5.  
  6. import functools
  7.  
  8. class SpamChecker(object):
  9.     def spamCheck(self, judgeLog, good, bad):
  10.         return (("" if functools.reduce((lambda x, y: (x[0] + (good if judgeLog[y] == "o" else -bad), x[1] | ((x[0] + (good if judgeLog[y] == "o" else -bad)) < 0))), range(len(judgeLog)), (0, 0))[1] else "NOT ") + SPAM")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement