Advent of Code 2024 Day 18

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ธ.ค. 2024

ความคิดเห็น • 10

  • @StephenHouser
    @StephenHouser วันที่ผ่านมา

    Thank you for the videos and commentary. I watched them all last year and was looking forward to them again this year. Even though I've switched to C++, seeing your Python solutions is still fun.

  • @GrepHaxs
    @GrepHaxs 2 วันที่ผ่านมา +2

    For a faster part2 what I did was track the points in the initial connected path at 1024. Then add the corrupt bits 1 by 1 and check my path to see if the new corrupt point was on my path. Only if it was on my path I re-ran the path finding portion. For my input this reduced the number of times I re ran bfs to 32 with total execution time around 250ms.

  • @mathiaskern7031
    @mathiaskern7031 2 วันที่ผ่านมา +5

    Part 2: binary search.

  • @rastislavsvoboda4363
    @rastislavsvoboda4363 2 วันที่ผ่านมา +3

    for p2 I've skipped first 1024 tries, knowing it is reachable ;-); it runs ~2.5s
    nothing fancy was needed

    • @alain_gilbert
      @alain_gilbert 2 วันที่ผ่านมา +3

      You can also skip doing the bfs entirely if the new points are not on the path. mine run in ~0.03s

  • @pipdjs
    @pipdjs วันที่ผ่านมา

    I did astar. For p2 I reversed it (started with all corrupt bytes in) and went until it did find a path, but idk if that was maybe only good for my data (my answer was on line 3000 out of 3400 something)

  • @AymanAlSairafi
    @AymanAlSairafi 2 วันที่ผ่านมา +1

    Off by one for me too.. I thought my search algorithm was wrong. Sneaky from Eric to make it so ;-)

  • @rastislavsvoboda4363
    @rastislavsvoboda4363 2 วันที่ผ่านมา +1

    just tried P2 with binary search
    runs ~100-150ms

  • @shahzodshafizod
    @shahzodshafizod 2 วันที่ผ่านมา

    Hi, thanks for daily videos. Can you please share the settings of your vim, syntax highlights and so on. I wanna switch from vs code to vim and researching it. Thanks in advance

  • @waplet
    @waplet วันที่ผ่านมา

    also hit the 70+1 error...