diff options
| author | Gustav Sörnäs <gusso230@student.liu.se> | 2019-12-04 07:09:10 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gusso230@student.liu.se> | 2019-12-04 07:09:10 +0100 |
| commit | a8df3112a2378aa62ea920f3d202204fc019ad19 (patch) | |
| tree | de5798dec1af3c277f6585f4b8cf5adf1bc46982 /solutions/py/03-2.py | |
| parent | 831755fdc6d430bd8781da1897270cf2934bc858 (diff) | |
| download | aoc-a8df3112a2378aa62ea920f3d202204fc019ad19.tar.gz | |
Cleanup
Diffstat (limited to 'solutions/py/03-2.py')
| -rw-r--r-- | solutions/py/03-2.py | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/solutions/py/03-2.py b/solutions/py/03-2.py index adb95a2..0bb1efc 100644 --- a/solutions/py/03-2.py +++ b/solutions/py/03-2.py @@ -1,13 +1,11 @@ import math def intersection(l1, l2): - tmp = set(l1) - return [value for value in l2 if value in tmp] + return [value for value in l2 if value in l1] def man_dist(point): return abs(point[0]) + abs(point[1]) - wire1 = {} wire2 = {} # wire {(x,y) : dist} @@ -37,9 +35,6 @@ for wire in (wire1, wire2): wire[(x, y)] = steps points = intersection(list(wire1.keys()), list(wire2.keys())) -print(len(points)) -for point in points: - print(point, wire1[point], wire2[point]) length = wire1[points[0]] + wire2[points[0]] for point in points[1:]: length = min(length, wire1[point] + wire2[point]) |
