generated from public/aoc_template
problem 3 - shortened
This commit is contained in:
parent
ab587caee4
commit
028df5de61
@ -11,14 +11,8 @@ for line in my_input:
|
|||||||
p1 += l_high - l_low + 1
|
p1 += l_high - l_low + 1
|
||||||
p1 += r_high - r_low + 1
|
p1 += r_high - r_low + 1
|
||||||
|
|
||||||
if r_low < l_low:
|
|
||||||
l_low, l_high, r_low, r_high = r_low, r_high, l_low, l_high
|
|
||||||
|
|
||||||
if l_high < r_low:
|
|
||||||
this_box_set = set(range(l_low, l_high + 1))
|
this_box_set = set(range(l_low, l_high + 1))
|
||||||
this_box_set |= set(range(r_low, r_high + 1))
|
this_box_set |= set(range(r_low, r_high + 1))
|
||||||
else:
|
|
||||||
this_box_set = set(range(min(l_low, r_low), max(l_high, r_high) + 1))
|
|
||||||
|
|
||||||
p2 += len(this_box_set)
|
p2 += len(this_box_set)
|
||||||
if len(this_box_set | last_boxes) > p3:
|
if len(this_box_set | last_boxes) > p3:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user