Advent of Code 2021 day 24
12/24/2022, 5:00 AMSergei Petunin
12/24/2022, 6:02 AMJohannes Gätjen
12/24/2022, 6:06 AMJohannes Gätjen
12/24/2022, 6:07 AMJan Durovec
12/24/2022, 6:12 AMMarcin Wisniowski
12/24/2022, 6:29 AMJan Durovec
12/24/2022, 6:31 AMVlad Petrushkevich
12/24/2022, 6:39 AMJohannes Gätjen
12/24/2022, 6:42 AMIn the above example, the first trip to the goal takesminutes, the trip back to the start takes18
minutes, and the trip back to the goal again takes23
minutes13
Marcin Wisniowski
12/24/2022, 6:42 AMJakub Gwóźdź
12/24/2022, 6:51 AMJakub Gwóźdź
12/24/2022, 6:53 AMval lcm = with(rows.count() to cols.count()) {
when (this) {
(4 to 6) -> 12 // test input
(25 to 120) -> 600 // real input
else -> TODO(this.toString())
}
}
Marcin Wisniowski
12/24/2022, 7:01 AMJakub Gwóźdź
12/24/2022, 7:02 AMJohannes Gätjen
12/24/2022, 7:06 AMJohannes Gätjen
12/24/2022, 7:11 AMJintin
12/24/2022, 7:17 AMCognitive Gear
12/24/2022, 7:25 AMelizarov
12/24/2022, 7:26 AMbabel
12/24/2022, 7:27 AMCognitive Gear
12/24/2022, 7:27 AMJonathan Kolberg
12/24/2022, 7:28 AMbabel
12/24/2022, 7:29 AMCognitive Gear
12/24/2022, 7:29 AMbabel
12/24/2022, 7:29 AMelizarov
12/24/2022, 7:30 AMO(n*m)
states at each time. So if you explore a states forward in time, it works in O(n*m*answer)
Jonathan Kolberg
12/24/2022, 7:50 AMSergei Petunin
12/24/2022, 8:20 AMstep % lcm(width - 2, height - 2)
, and 2) used DFS instead of BFS.Sergei Petunin
12/24/2022, 8:35 AMJakub Gwóźdź
12/24/2022, 8:41 AMephemient
12/24/2022, 9:08 AMephemient
12/24/2022, 9:09 AMephemient
12/24/2022, 9:10 AMCognitive Gear
12/24/2022, 9:16 AMOlaf Gottschalk
12/24/2022, 9:33 AMkqr
12/24/2022, 2:30 PMphldavies
12/24/2022, 2:32 PMfun part2() = solve { entrance travelTo exit travelTo entrance travelTo exit }
phldavies
12/24/2022, 2:35 PMBooleanArray
indexed by x, y, t
where t
determines a positive or negative offset in either x
or y
based on the direction of the blizzards.Jonathan Kolberg
12/24/2022, 4:45 PMkqr
12/25/2022, 11:33 AMJonathan Kolberg
12/25/2022, 12:31 PMPaul Woitaschek
12/26/2022, 10:02 PMJakub Gwóźdź
12/27/2022, 8:12 AMPaul Woitaschek
12/27/2022, 8:15 AMJakub Gwóźdź
12/27/2022, 8:17 AMFrom the same initial conditions, how quickly can you make it from the start to the goal, then back to the start, then back to the goal?
Olaf Gottschalk
12/27/2022, 9:48 AMJakub Gwóźdź
12/27/2022, 9:50 AMOlaf Gottschalk
12/27/2022, 11:43 AMOlaf Gottschalk
12/27/2022, 11:43 AMritesh
01/03/2023, 1:19 PMAs a blizzard reaches the wall of the valley, a new blizzard forms on the opposite side of the valley moving in the same direction.What happens when a blizzard reaches the Start and End position.
#^#####
#.....#
#.....#
#.....#
#.....#
#.....#
#####v#
phldavies
01/03/2023, 1:20 PMJohannes Gätjen
01/03/2023, 1:21 PMphldavies
01/03/2023, 1:21 PM