From b0238d6e5f9438098dae9d875040091e0b361deb Mon Sep 17 00:00:00 2001 From: Valentin Ochs Date: Fri, 4 Dec 2020 00:48:48 +0100 Subject: [PATCH] Optimize 2-2 some more --- 02-2-1.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/02-2-1.py b/02-2-1.py index 300c294..6750272 100644 --- a/02-2-1.py +++ b/02-2-1.py @@ -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")))