Compare commits

..

71 commits

Author SHA1 Message Date
Bruno BELANYI 5b084a755b 2024: d19: ex2: add solution 2024-12-19 00:11:14 -05:00
Bruno BELANYI a363dd9172 2024: d19: ex2: add input 2024-12-19 00:11:08 -05:00
Bruno BELANYI aff6966078 2024: d19: ex1: add solution 2024-12-19 00:11:03 -05:00
Bruno BELANYI 37470beec0 2024: d19: ex1: add input 2024-12-19 00:10:57 -05:00
Bruno BELANYI a83c7cb441 2024: d18: ex2: add solution 2024-12-18 00:25:04 -05:00
Bruno BELANYI b69cbd0e62 2024: d18: ex2: add input 2024-12-18 00:24:53 -05:00
Bruno BELANYI 6dc74c4dcb 2024: d18: ex1: add solution 2024-12-18 00:24:47 -05:00
Bruno BELANYI ed1cccab46 2024: d18: ex1: add input 2024-12-18 00:24:40 -05:00
Bruno BELANYI 5a6658764d 2024: d17: ex2: add solution 2024-12-17 13:11:08 -05:00
Bruno BELANYI c1c1429deb 2024: d17: ex2: add input 2024-12-17 13:10:57 -05:00
Bruno BELANYI 8c1cdd2b7d 2024: d17: ex1: add solution 2024-12-17 13:10:51 -05:00
Bruno BELANYI 5154037cf9 2024: d17: ex1: add input 2024-12-17 13:10:44 -05:00
Bruno BELANYI 1468ef5a9b 2024: d16: ex2: add solution 2024-12-16 14:54:20 -05:00
Bruno BELANYI 93bbb5bae6 2024: d16: ex2: add input 2024-12-16 14:54:15 -05:00
Bruno BELANYI 32a92bd813 2024: d16: ex1: add solution 2024-12-16 14:54:09 -05:00
Bruno BELANYI f2751ddee8 2024: d16: ex1: add input 2024-12-16 14:54:04 -05:00
Bruno BELANYI f761721daf 2024: d15: ex2: add solution 2024-12-15 11:01:06 -05:00
Bruno BELANYI bfdbdf6499 2024: d15: ex2: add input 2024-12-15 11:01:01 -05:00
Bruno BELANYI d0dd6a1bbb 2024: d15: ex1: add solution 2024-12-15 11:00:54 -05:00
Bruno BELANYI 7bd3033950 2024: d15: ex1: add input 2024-12-15 11:00:49 -05:00
Bruno BELANYI 135980fd92 2024: d14: ex2: add solution 2024-12-14 11:22:58 -05:00
Bruno BELANYI f6119c763e 2024: d14: ex2: add input 2024-12-14 11:22:54 -05:00
Bruno BELANYI dbff9dc49b 2024: d14: ex1: add solution 2024-12-14 11:22:46 -05:00
Bruno BELANYI bf7e3eb6dc 2024: d14: ex1: add input 2024-12-14 11:22:39 -05:00
Bruno BELANYI 8eb066cd31 2024: d13: ex2: add solution 2024-12-13 01:51:43 -05:00
Bruno BELANYI 086b0738f9 2024: d13: ex2: add input 2024-12-13 01:51:38 -05:00
Bruno BELANYI 8cbe50560c 2024: d13: ex1: add solution 2024-12-13 01:51:32 -05:00
Bruno BELANYI fc6314d77a 2024: d13: ex1: add input 2024-12-13 01:51:28 -05:00
Bruno BELANYI 1a77489993 2024: d12: ex2: add solution 2024-12-12 10:01:22 -05:00
Bruno BELANYI a90594264e 2024: d12: ex2: add input 2024-12-12 10:01:03 -05:00
Bruno BELANYI 176c75fe29 2024: d12: ex1: add solution 2024-12-12 10:00:57 -05:00
Bruno BELANYI 14cb7d2e4c 2024: d12: ex1: add input 2024-12-12 10:00:51 -05:00
Bruno BELANYI bf55c70575 2024: d11: ex2: add solution 2024-12-11 09:16:17 -05:00
Bruno BELANYI 745ebfb958 2024: d11: ex2: add input 2024-12-11 09:16:12 -05:00
Bruno BELANYI 1b35dcc867 2024: d11: ex1: add solution 2024-12-11 09:16:06 -05:00
Bruno BELANYI 6e3bf64572 2024: d11: ex1: add input 2024-12-11 09:16:00 -05:00
Bruno BELANYI acc32964f5 2024: d10: ex2: add solution 2024-12-10 00:20:29 -05:00
Bruno BELANYI fbd0412fcf 2024: d10: ex2: add input 2024-12-10 00:20:22 -05:00
Bruno BELANYI bea8be1bcb 2024: d10: ex1: add solution 2024-12-10 00:20:16 -05:00
Bruno BELANYI e36fb40f57 2024: d10: ex1: add input 2024-12-10 00:20:10 -05:00
Bruno BELANYI f92e492f9b 2024: d09: ex2: add solution 2024-12-09 08:48:31 -05:00
Bruno BELANYI d32b04307b 2024: d09: ex2: add input 2024-12-09 08:48:23 -05:00
Bruno BELANYI 2fbe2677b9 2024: d09: ex1: add solution 2024-12-09 08:48:17 -05:00
Bruno BELANYI b5e7da0192 2024: d09: ex1: add input 2024-12-09 08:48:10 -05:00
Bruno BELANYI e348cea55a 2024: d08: ex2: add solution 2024-12-08 05:16:55 +00:00
Bruno BELANYI 46562ae83e 2024: d08: ex2: add input 2024-12-08 05:16:50 +00:00
Bruno BELANYI f11dd876e1 2024: d08: ex1: add solution 2024-12-08 05:16:44 +00:00
Bruno BELANYI 32405e191b 2024: d08: ex1: add input 2024-12-08 05:16:38 +00:00
Bruno BELANYI 16ecc11f85 2024: d07: ex2: add solution 2024-12-07 10:43:12 +00:00
Bruno BELANYI 054804a48e 2024: d07: ex2: add input 2024-12-07 10:43:07 +00:00
Bruno BELANYI ac57e45407 2024: d07: ex1: add solution 2024-12-07 10:43:00 +00:00
Bruno BELANYI d9c6811a52 2024: d07: ex1: add input 2024-12-07 10:42:51 +00:00
Bruno BELANYI ae8d312cea 2024: d06: ex2: add solution 2024-12-06 11:06:14 +00:00
Bruno BELANYI 1a24f1a6a4 2024: d06: ex2: add input 2024-12-06 11:05:59 +00:00
Bruno BELANYI 669f6ace89 2024: d06: ex1: add solution 2024-12-06 11:05:51 +00:00
Bruno BELANYI 630798d6f9 2024: d06: ex1: add input 2024-12-06 11:05:42 +00:00
Bruno BELANYI 16b3bf450c 2024: d05: ex2: add solution 2024-12-05 10:47:22 +00:00
Bruno BELANYI 4ae17d8d39 2024: d05: ex2: add input 2024-12-05 10:47:15 +00:00
Bruno BELANYI bcb14696be 2024: d05: ex1: add solution 2024-12-05 10:47:08 +00:00
Bruno BELANYI 0b27ad91a7 2024: d05: ex1: add input 2024-12-05 10:46:59 +00:00
Bruno BELANYI 15e50e8dec 2024: d04: ex2: add solution 2024-12-04 10:36:07 +00:00
Bruno BELANYI 895a26c2a9 2024: d04: ex2: add input 2024-12-04 10:35:51 +00:00
Bruno BELANYI ef00c627c4 2024: d04: ex1: add solution 2024-12-04 10:35:39 +00:00
Bruno BELANYI e7d9983569 2024: d04: ex1: add input 2024-12-04 10:35:30 +00:00
Bruno BELANYI f6c24e698c 2024: d03: ex2: add solution 2024-12-03 10:13:19 +00:00
Bruno BELANYI a88e0e19ab 2024: d03: ex2: add input 2024-12-03 10:13:10 +00:00
Bruno BELANYI 9209a7b898 2024: d03: ex1: add solution 2024-12-03 10:12:55 +00:00
Bruno BELANYI c04acd017f 2024: d03: ex1: add input 2024-12-03 10:12:45 +00:00
Bruno BELANYI 2bde03be73 2024: d02: ex2: add solution 2024-12-02 10:24:02 +00:00
Bruno BELANYI fec779135e 2024: d02: ex2: add input 2024-12-02 10:23:35 +00:00
Bruno BELANYI 763df4c904 2024: d02: ex1: add solution 2024-12-02 10:23:23 +00:00
4 changed files with 12 additions and 7 deletions

View file

@ -11,8 +11,11 @@ def solve(input: list[str]) -> int:
return [[int(n) for n in line.split()] for line in input] return [[int(n) for n in line.split()] for line in input]
def is_safe(report: Report) -> bool: def is_safe(report: Report) -> bool:
def is_increasing_safe(report: Report) -> bool: def is_increasing_safe(report: Report):
return all(1 <= (b - a) <= 3 for a, b in itertools.pairwise(report)) for a, b in itertools.pairwise(report):
if not 1 <= (b - a) <= 3:
return False
return True
return is_increasing_safe(report) or is_increasing_safe(report[::-1]) return is_increasing_safe(report) or is_increasing_safe(report[::-1])

View file

@ -11,8 +11,11 @@ def solve(input: list[str]) -> int:
return [[int(n) for n in line.split()] for line in input] return [[int(n) for n in line.split()] for line in input]
def is_safe(report: Report) -> bool: def is_safe(report: Report) -> bool:
def is_increasing_safe(report: Report) -> bool: def is_increasing_safe(report: Report):
return all(1 <= (b - a) <= 3 for a, b in itertools.pairwise(report)) for a, b in itertools.pairwise(report):
if not 1 <= (b - a) <= 3:
return False
return True
return is_increasing_safe(report) or is_increasing_safe(report[::-1]) return is_increasing_safe(report) or is_increasing_safe(report[::-1])

View file

@ -99,7 +99,7 @@ def solve(input: str) -> int:
if pred in visited: if pred in visited:
continue continue
queue.add(pred) queue.add(pred)
return {p for p, _ in visited} return set(p for p, _ in visited)
# Priority queue of (distance, point) # Priority queue of (distance, point)
queue = [(0, start, Direction.EAST)] queue = [(0, start, Direction.EAST)]

View file

@ -2,8 +2,7 @@
import heapq import heapq
import sys import sys
from collections.abc import Iterator from typing import Iterator, NamedTuple
from typing import NamedTuple
class Point(NamedTuple): class Point(NamedTuple):