MCPcopy Create free account
hub / github.com/AxlLind/AdventOfCode / main

Function main

2018/src/03.py:7–16  ·  view source on GitHub ↗
(indata: str)

Source from the content-addressed store, hash-verified

5
6@aoc.main('03')
7def main(indata: str) -> tuple[int,int]:
8 squares = [[int(i) for i in re.findall("\d+",l)] for l in indata.split('\n')]
9 points = defaultdict[tuple[int,int],int](int)
10 for _,x,y,h,w in squares:
11 for p in product(range(x,x+h), range(y,y+w)):
12 points[p] += 1
13 for p2,x,y,h,w in squares:
14 if all(points[p] == 1 for p in product(range(x,x+h), range(y,y+w))):
15 break
16 return sum(c > 1 for c in points.values()), p2
17
18if __name__ == "__main__":
19 main()

Callers 1

03.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected