22 lines
413 B
Python
22 lines
413 B
Python
|
import sys
|
||
|
|
||
|
def matches2score(n):
|
||
|
if n <= 0:
|
||
|
return 0
|
||
|
return 2**(n-1)
|
||
|
|
||
|
input = sys.stdin
|
||
|
part1 = 0
|
||
|
for line in input:
|
||
|
_, _, data = line.partition(": ")
|
||
|
winners, numbers = data.split("|")
|
||
|
winners = map(int, winners.split())
|
||
|
numbers = map(int, numbers.split())
|
||
|
|
||
|
matches = len(set(winners) & set(numbers))
|
||
|
s = matches2score(matches)
|
||
|
print(s)
|
||
|
part1 += s
|
||
|
|
||
|
print(part1)
|