From a6c027a1af91fc02c5157817250619ba017aa1cc Mon Sep 17 00:00:00 2001 From: setop Date: Mon, 11 Dec 2023 12:36:22 +0100 Subject: [PATCH] day 11, 1 is also 2-1 --- d11/run.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 d11/run.py diff --git a/d11/run.py b/d11/run.py new file mode 100644 index 0000000..81ba234 --- /dev/null +++ b/d11/run.py @@ -0,0 +1,27 @@ +import sys +from itertools import combinations as Comb + +I = sys.stdin.read().splitlines() # for codon type inference +L = [list(l) for l in I] +H = len(L) +W = len(L[0]) + +RD = [y for y in range(W) if all(L[y][x] == '.' for x in range(H))] +CD = [x for x in range(H) if all(L[y][x] == '.' for y in range(W))] +G = [(x,y) for y in range(W) for x in range(H) if L[y][x] == '#'] + +# expantion factor, 2 for part 1, 1E6 for part 2 +X = int(float(sys.argv[1])) # float to parse scientific form, int for codon + +def exp(a:int, b:int, S:list[int]) -> int: + if a > b: + b, a = a, b + return sum(1 for s in S if a