Optimize 2-2 some more

master
Valentin Ochs 2020-12-04 00:48:48 +01:00
parent b8b7087bc4
commit b0238d6e5f
1 changed files with 4 additions and 4 deletions

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")))