Fix 2024 day 2.

This commit is contained in:
Mikaël Capelle 2024-12-02 18:44:50 +01:00
parent 2a4f923552
commit 540fe37b9d

View File

@ -13,7 +13,7 @@ def is_any_safe(level: list[int]) -> bool:
return any(is_safe(level[:i] + level[i + 1 :]) for i in range(0, len(level))) return any(is_safe(level[:i] + level[i + 1 :]) for i in range(0, len(level)))
levels = [[int(c) for c in r.split()] for r in sys.stdin.read().splitlines()] levels = [[int(c) for c in r.split()] for r in sys.stdin.read().strip().splitlines()]
answer_1 = sum(is_safe(level) for level in levels) answer_1 = sum(is_safe(level) for level in levels)
answer_2 = sum(is_safe(level) or is_any_safe(level) for level in levels) answer_2 = sum(is_safe(level) or is_any_safe(level) for level in levels)