Skip to content

Instantly share code, notes, and snippets.

@lucemia
Created April 13, 2014 04:47
Show Gist options
  • Select an option

  • Save lucemia/10569670 to your computer and use it in GitHub Desktop.

Select an option

Save lucemia/10569670 to your computer and use it in GitHub Desktop.
2014 code jam 1 with python
import StringIO
import fileinput
import sys
input = sys.stdin
def main(input):
T = int(input.readline())
for i in range(T):
ans1 = int(input.readline())
arr1 = []
for k in range(4):
arr1.append(input.readline().split())
card1 = set(arr1[ans1-1])
ans2 = int(input.readline())
arr2 = []
for k in range(4):
arr2.append(input.readline().split())
card2 = set(arr2[ans2-1])
print "Case #%s:"% (i+1),
c = card1 & card2
if len(c) == 1:
print list(c)[0]
elif len(c) > 1:
print "Bad magician!"
else:
print "Volunteer cheated!"
main(input)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment