Optimize 2-2 some more

This commit is contained in:
Lynn Ochs 2020-12-04 00:48:48 +01:00
parent b8b7087bc4
commit b0238d6e5f

View File

@ -1,4 +1,4 @@
def f(k):
a,b,c=*map(int,k[0].split('-')),k[1][0]
return (k[2][a-1]==c)^(k[2][b-1]==c)
print(sum(f(x.split()) for x in open("/dev/stdin")))
def f(d,e,f):
a,b=*map(int,d.split('-'))
return (f[a-1]==e[0])^(f[b-1]==e[0])
print(sum(f(*x.split()) for x in open("/dev/stdin")))