Skip to content

Instantly share code, notes, and snippets.

@Bekt
Created April 14, 2014 18:11
Show Gist options
  • Save Bekt/10670600 to your computer and use it in GitHub Desktop.
Save Bekt/10670600 to your computer and use it in GitHub Desktop.
CodeJam 2014 - Problem A
#!/usr/bin/env python3
''' Problem A: Magic Trick https://code.google.com/codejam/contest/2974486/dashboard#s=p0 '''
def get_int():
return int(input())
def solve():
choice1 = get_int() - 1
arr1 = [set(input().split()) for x in range(4)]
choice2 = get_int() - 1
arr2 = [set(input().split()) for x in range(4)]
diff = arr1[choice1] & arr2[choice2]
if not len(diff):
return 'Volunteer cheated!'
if len(diff) > 1:
return 'Bad magician!'
return diff.pop()
for x in range(get_int()):
print('Case #{}: {}'.format(x + 1, solve()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment