Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- TCO 2014 Round 1B (Almost) One-liner Solution in Python
- Although I'm sure this is absolutely unreadable at a glance, don't read further if you want to do it yourself.
- """
- import functools
- class SpamChecker(object):
- def spamCheck(self, judgeLog, good, bad):
- 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