Its cute how the c++ version of day 5 is shorter

This commit is contained in:
Daniel Cortés
2020-12-05 06:43:15 -03:00
parent 00ab24ff28
commit 01d1f9e7cd
2 changed files with 47 additions and 4 deletions

View File

@@ -18,7 +18,9 @@ def from_binary(bsp):
return int(bsp.replace('F', '0').replace('L', '0').replace('B', '1').replace('R', '1'), 2)
def get_id(row, col): return row * 8 + col
def get_id(row, col):
# return row * 8 + col
return row << 3 | col
def parse_seats(data):
seats = []
@@ -45,6 +47,3 @@ def solve_b(seats):
seats = parse_seats(data)
print(solve_a(seats))
print(solve_b(seats))