summaryrefslogtreecommitdiffstats
path: root/12.py
diff options
context:
space:
mode:
authorTomasz Kramkowski <tomasz@kramkow.ski>2023-12-12 10:15:04 +0000
committerTomasz Kramkowski <tomasz@kramkow.ski>2023-12-12 10:15:04 +0000
commit7a02361e62b282a12f5d693858f7fb2e99a7f029 (patch)
treed8d042fcfc0730994e6e41fcd3653b4a68195965 /12.py
parent44877113c1b782f820464be7bc412751c63d7f1f (diff)
downloadaoc2023-7a02361e62b282a12f5d693858f7fb2e99a7f029.tar.gz
aoc2023-7a02361e62b282a12f5d693858f7fb2e99a7f029.tar.xz
aoc2023-7a02361e62b282a12f5d693858f7fb2e99a7f029.zip
"oneline" the final loop
Diffstat (limited to '12.py')
-rw-r--r--12.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/12.py b/12.py
index 100c010..2c2810c 100644
--- a/12.py
+++ b/12.py
@@ -29,9 +29,9 @@ for line in stdin:
print(sum(matching(pattern, groups, len(pattern)) for pattern, groups in inp))
-
-p2 = 0
-for pattern, groups in inp:
- pattern = "?".join([pattern] * 5)
- p2 += matching(pattern, groups * 5, len(pattern))
-print(p2)
+print(
+ sum(
+ matching("?".join([pattern] * 5), groups * 5, len(pattern) * 5 + 4)
+ for pattern, groups in inp
+ )
+)