Compare commits

..

71 commits

Author SHA1 Message Date
Bruno BELANYI 080e4e74ec 2024: d19: ex2: add solution 2024-12-19 00:11:14 -05:00
Bruno BELANYI a05e17d50c 2024: d19: ex2: add input 2024-12-19 00:11:08 -05:00
Bruno BELANYI d38c370f4f 2024: d19: ex1: add solution 2024-12-19 00:11:03 -05:00
Bruno BELANYI a49aa0cbca 2024: d19: ex1: add input 2024-12-19 00:10:57 -05:00
Bruno BELANYI d9e3dba3ce 2024: d18: ex2: add solution 2024-12-18 00:25:04 -05:00
Bruno BELANYI 9306c7c462 2024: d18: ex2: add input 2024-12-18 00:24:53 -05:00
Bruno BELANYI bb3386c083 2024: d18: ex1: add solution 2024-12-18 00:24:47 -05:00
Bruno BELANYI 531991c6c5 2024: d18: ex1: add input 2024-12-18 00:24:40 -05:00
Bruno BELANYI bc200592c4 2024: d17: ex2: add solution 2024-12-17 13:11:08 -05:00
Bruno BELANYI de285154cf 2024: d17: ex2: add input 2024-12-17 13:10:57 -05:00
Bruno BELANYI bd44f8abc8 2024: d17: ex1: add solution 2024-12-17 13:10:51 -05:00
Bruno BELANYI c5cbd8d499 2024: d17: ex1: add input 2024-12-17 13:10:44 -05:00
Bruno BELANYI 5176ba5723 2024: d16: ex2: add solution 2024-12-16 14:54:20 -05:00
Bruno BELANYI 8e747b503f 2024: d16: ex2: add input 2024-12-16 14:54:15 -05:00
Bruno BELANYI 5e240ff71d 2024: d16: ex1: add solution 2024-12-16 14:54:09 -05:00
Bruno BELANYI cd139b14b1 2024: d16: ex1: add input 2024-12-16 14:54:04 -05:00
Bruno BELANYI fa1ac05b77 2024: d15: ex2: add solution 2024-12-15 11:01:06 -05:00
Bruno BELANYI 995f60fdb0 2024: d15: ex2: add input 2024-12-15 11:01:01 -05:00
Bruno BELANYI fe6ae49833 2024: d15: ex1: add solution 2024-12-15 11:00:54 -05:00
Bruno BELANYI ed9d601284 2024: d15: ex1: add input 2024-12-15 11:00:49 -05:00
Bruno BELANYI dcd885f641 2024: d14: ex2: add solution 2024-12-14 11:22:58 -05:00
Bruno BELANYI 8d73ecea78 2024: d14: ex2: add input 2024-12-14 11:22:54 -05:00
Bruno BELANYI 7e54035bef 2024: d14: ex1: add solution 2024-12-14 11:22:46 -05:00
Bruno BELANYI c8a9d25770 2024: d14: ex1: add input 2024-12-14 11:22:39 -05:00
Bruno BELANYI 681c85169b 2024: d13: ex2: add solution 2024-12-13 01:51:43 -05:00
Bruno BELANYI b6cac39da0 2024: d13: ex2: add input 2024-12-13 01:51:38 -05:00
Bruno BELANYI 6aa81cdb13 2024: d13: ex1: add solution 2024-12-13 01:51:32 -05:00
Bruno BELANYI bd73041e6d 2024: d13: ex1: add input 2024-12-13 01:51:28 -05:00
Bruno BELANYI a5efe0f7ec 2024: d12: ex2: add solution 2024-12-12 10:01:22 -05:00
Bruno BELANYI f56392b78f 2024: d12: ex2: add input 2024-12-12 10:01:03 -05:00
Bruno BELANYI 94ee0dc642 2024: d12: ex1: add solution 2024-12-12 10:00:57 -05:00
Bruno BELANYI 6a4b8a1a67 2024: d12: ex1: add input 2024-12-12 10:00:51 -05:00
Bruno BELANYI d4bca4bbad 2024: d11: ex2: add solution 2024-12-11 09:16:17 -05:00
Bruno BELANYI a38bf45fa6 2024: d11: ex2: add input 2024-12-11 09:16:12 -05:00
Bruno BELANYI d1653a9aec 2024: d11: ex1: add solution 2024-12-11 09:16:06 -05:00
Bruno BELANYI 9f8f458c01 2024: d11: ex1: add input 2024-12-11 09:16:00 -05:00
Bruno BELANYI a35ae47246 2024: d10: ex2: add solution 2024-12-10 00:20:29 -05:00
Bruno BELANYI a286419745 2024: d10: ex2: add input 2024-12-10 00:20:22 -05:00
Bruno BELANYI 2572015d79 2024: d10: ex1: add solution 2024-12-10 00:20:16 -05:00
Bruno BELANYI ffe7be04fe 2024: d10: ex1: add input 2024-12-10 00:20:10 -05:00
Bruno BELANYI a33530ec13 2024: d09: ex2: add solution 2024-12-09 08:48:31 -05:00
Bruno BELANYI 2315fe3fa5 2024: d09: ex2: add input 2024-12-09 08:48:23 -05:00
Bruno BELANYI c6a9bb406b 2024: d09: ex1: add solution 2024-12-09 08:48:17 -05:00
Bruno BELANYI d593c86613 2024: d09: ex1: add input 2024-12-09 08:48:10 -05:00
Bruno BELANYI f633512263 2024: d08: ex2: add solution 2024-12-08 05:16:55 +00:00
Bruno BELANYI 835645531b 2024: d08: ex2: add input 2024-12-08 05:16:50 +00:00
Bruno BELANYI 5c352109de 2024: d08: ex1: add solution 2024-12-08 05:16:44 +00:00
Bruno BELANYI 0da5366293 2024: d08: ex1: add input 2024-12-08 05:16:38 +00:00
Bruno BELANYI 55568ccdb3 2024: d07: ex2: add solution 2024-12-07 10:43:12 +00:00
Bruno BELANYI 872b3bb98f 2024: d07: ex2: add input 2024-12-07 10:43:07 +00:00
Bruno BELANYI b918737ed1 2024: d07: ex1: add solution 2024-12-07 10:43:00 +00:00
Bruno BELANYI bf4018ac8b 2024: d07: ex1: add input 2024-12-07 10:42:51 +00:00
Bruno BELANYI 3eb1ed97df 2024: d06: ex2: add solution 2024-12-06 11:06:14 +00:00
Bruno BELANYI fb0a35831e 2024: d06: ex2: add input 2024-12-06 11:05:59 +00:00
Bruno BELANYI f6950f1c0a 2024: d06: ex1: add solution 2024-12-06 11:05:51 +00:00
Bruno BELANYI 6ce2468a20 2024: d06: ex1: add input 2024-12-06 11:05:42 +00:00
Bruno BELANYI 31c7a2d1e7 2024: d05: ex2: add solution 2024-12-05 10:47:22 +00:00
Bruno BELANYI 24ecbc6b74 2024: d05: ex2: add input 2024-12-05 10:47:15 +00:00
Bruno BELANYI fde618ecf6 2024: d05: ex1: add solution 2024-12-05 10:47:08 +00:00
Bruno BELANYI 42f91d84c9 2024: d05: ex1: add input 2024-12-05 10:46:59 +00:00
Bruno BELANYI 1712f53ff7 2024: d04: ex2: add solution 2024-12-04 10:36:07 +00:00
Bruno BELANYI 5fa5d3db54 2024: d04: ex2: add input 2024-12-04 10:35:51 +00:00
Bruno BELANYI d055076659 2024: d04: ex1: add solution 2024-12-04 10:35:39 +00:00
Bruno BELANYI 93314299fb 2024: d04: ex1: add input 2024-12-04 10:35:30 +00:00
Bruno BELANYI 7bebb8a981 2024: d03: ex2: add solution 2024-12-03 10:13:19 +00:00
Bruno BELANYI 67ab17f1f8 2024: d03: ex2: add input 2024-12-03 10:13:10 +00:00
Bruno BELANYI 170173e5d3 2024: d03: ex1: add solution 2024-12-03 10:12:55 +00:00
Bruno BELANYI de2503d8fd 2024: d03: ex1: add input 2024-12-03 10:12:45 +00:00
Bruno BELANYI 28a945c421 2024: d02: ex2: add solution 2024-12-02 10:24:02 +00:00
Bruno BELANYI 78ff7514f8 2024: d02: ex2: add input 2024-12-02 10:23:35 +00:00
Bruno BELANYI 3db8436347 2024: d02: ex1: add solution 2024-12-02 10:23:23 +00:00
4 changed files with 7 additions and 12 deletions

View file

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

View file

@ -11,11 +11,8 @@ def solve(input: list[str]) -> int:
return [[int(n) for n in line.split()] for line in input]
def is_safe(report: Report) -> bool:
def is_increasing_safe(report: Report):
for a, b in itertools.pairwise(report):
if not 1 <= (b - a) <= 3:
return False
return True
def is_increasing_safe(report: Report) -> bool:
return all(1 <= (b - a) <= 3 for a, b in itertools.pairwise(report))
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:
continue
queue.add(pred)
return set(p for p, _ in visited)
return {p for p, _ in visited}
# Priority queue of (distance, point)
queue = [(0, start, Direction.EAST)]

View file

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