Created
April 13, 2014 04:47
-
-
Save lucemia/10569670 to your computer and use it in GitHub Desktop.
2014 code jam 1 with python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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