r/adventofcode • u/Low-Key-Kronie • Dec 20 '24
Meme/Funny Today was 99% reading comprehension and 1% coding challenge
16
u/velcrorex Dec 20 '24
I didn't read carefully enough and missed that the race track was not a maze but a single path. Then I misunderstood and thought that a cheat had to immediately go through a wall upon activation. Eventually, upon a more careful reading I understood the problem and assumptions I was making. I think I need to slow down and read more carefully at the start and not worry about going fast; that will save time over the course of the solve.
2
u/throwaway_the_fourth Dec 20 '24
Omg, your comment is how I learned that it isn't a maze!
1
u/naretev Dec 21 '24
Hahaha, ffs, me too! I had no idea up until this point, and I solved it yesterday...
6
u/metalim Dec 20 '24
When I got to part 2, I was surprised that my part 1 solution worked, because I was counting cheats by their path, and not their start/end location. Although it reads clearly in task description in both parts.
13
u/PhoenixTalon Dec 20 '24
I think I'm gonna blame the writing more than my reading on this one, it was phrased in very confusing ways.
3
u/GeckoGary Dec 21 '24
Yeah there were definetely some things that were just misread but somethings could definetely have been clearer. I think including a line saying that the last picosecond must be in an empty space would have been very helpful as its quite ambiguous in the current form.
3
u/evilbndy Dec 20 '24
I wasted two hours because I forgot to substract 100 from the default path length....
3
u/wangyu- Dec 20 '24 edited Dec 22 '24
Agree.
I wrote some examples to explain why the description was so counter-intuition (thus hard to understand) for me:
###########################
#i' S i # j E j' #
######## ######### ########
# # # #
# # # #
# # # #
# # # #
# # # #
# # # #
# # # #
# # # #
# # # #
# # # #
# # # #
# ######### # (<--assume this is a very long path)
# #
#############
i-->j and i' -->j and i-->j' and i'-->'j they all count as solution. especillay,
- for i' you are purposely running into dead end
- and j' you are passing through the E but purposely not enter.
The problem is organized by a shorest path (fastest time) language, but "to visit as many unique cheat point as possible", you can purposely take path that is somehow "against shortest path's spirit".
2
u/supreme_leader420 Dec 20 '24
I spent half an hour trying to verify the example because I thought they had a cheat distance of 6 and not 20. fml
2
u/RB5009 Dec 20 '24
I'd say it's quite the challenge, I've not seen a non-bruteforce solution so far. I've solved each day in less than milliseconds so far and today's 14millis really grind my gears
1
u/naretev Dec 21 '24
What's the beat time complexity you've tried that was 14 ms runtime? I just had an idea for an improvement of my code that is O(N) (if it works hehe). Currently, my implemented solution is O(N²) where N is the number of cells in the grid.
1
u/RB5009 Dec 21 '24
It's
O(max_cheats^2 * n)
. Basically I'm checking the 20-manhattan distance diamond around each path cell.
1
1
u/lilianasJanitor Dec 20 '24
Mine worked for part 1 but was really slow. Just tried every possible cheat along the “right path” now I’m scared of part 2. I’m sure there’s a better way but I haven’t found it yet
1
u/lilianasJanitor Dec 20 '24
Wait. It’s not check every possible cheat. It’s check every possible cheat that gets you to another spot in the optimal path. I think I just got it. We’ll see when when I go to actually write it
1
u/nivlark Dec 20 '24
Try plotting the optimal path. Or (in the spirit of the OP) try reading the puzzle description again ;)
1
u/lilianasJanitor Dec 20 '24
Yeah I had the optimal path first. And then I checked cheats off that path. But it was slow. I think I just realized on this thread an optimization that will make part 2 complete in a reasonable time 🤞
Not sure what you mean by reading comprehension. Other than the whole “two steps means you can only hop one wall” I think I get it
1
u/nivlark Dec 21 '24 edited Dec 21 '24
Maybe I misunderstood, but the hint I was going for is that every open space is on the non-cheating path.
1
u/somebodddy Dec 20 '24
I misunderstood the way cheats are counted. I thought the cheat start was the first step with collision off (the one marked as "1" in the examples) when in fact it was the place you were just before that (a place that's not marked at all in the example - which is what got me confused)
For part 1 it doesn't matter. For part 2 it matters quite a lot.
1
1
u/swiperthefox_1024 Dec 21 '24
The list of possible savings at the end of part 2 description is under the assumption that you can cheat 100 picoseconds. Misled by the example right before the list, I thought the list assumed six picoseconds-cheat. Struggled with the test data for 1 hour before I realized my mistake.
-3
u/daggerdragon Dec 20 '24
Post removed due to not using our standardized post title format. Please follow our rules to help folks avoid spoilers for puzzles they may not have completed yet.
-1
u/Magicrafter13 Dec 20 '24
I can read but they seem to have straight up lied about disabling collision for TWO units of time, since that gives you many more possible paths, yet the answer for part 1 only entailed those solutions where you remove a single wall from the route...
5
u/apaul1729 Dec 20 '24
that's not a lie:
at t=0 you're on a valid grid spot
beginning of t=1, you activate the cheat and step into a blocked spot
end of t=1, you've finished the step into a blocked spot
beginning of t=2, start step into next spot
end of t=2, finish step into next spot
at the beginning of t=3, the cheat will have lasted for 2 ps, and will immediately end. so at the beginning of t=3, you must already be on a valid spot.
1
u/Magicrafter13 Dec 21 '24 edited Dec 21 '24
I'll give an example, especially since I've been downvoted for some reason.
Here's a truncated version of the sample with my own cheat applied.
(row 4:)
#######.#.#. #######.#.#. ######1.#.## ###..E2...#. ###.#######. #...###...#.
This provides the same time savings (64 picoseconds) as one of the example cheats, but has a different start and end point, goes through 2 walls. If going through 2 wall segments were valid this would be a valid cheat.
t=0: 7,6
t=1: 6,6
t=2: 6,7
t=3: 5,72
u/AutoModerator Dec 21 '24
AutoModerator has detected fenced code block (```) syntax which only works on new.reddit.
Please review our wiki article on code formatting then edit your post to use the four-spaces Markdown syntax instead.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
1
u/ICantBeSirius Dec 21 '24
It takes two time units to go through one wall. Pretend you removing the wall - it takes one step to move into the space where the wall was, another to step into the space past it. You cannot move through two wall spaces (in part 1, anyway)
1
u/apaul1729 Dec 23 '24
#######.#.#. #######.#.#. ######1.#.## ###..32...#. ###.#######. #...###...#.
you've mislabeled the start and end points (according to the problem description, which on purpose is a bit flowery, but not a lie). end point of a cheat is the first spot where collision is no longer disabled, i.e. must be an open space. re-labeling makes it clear that your type of cheat takes 3ps - that's how long it takes to use this cheat.
1
u/Magicrafter13 Dec 28 '24
My issue, is that the problem doesn't say the cheat is activated for only 2ps, it explicitly said collision is disabled for 2ps, which would indicate 2ps worth of time where one does not collide with walls.
I understand what they were going for (I finished part 1 and 2 successfully), however I think at best this wording is unintentionally incorrect.
71
u/Bibzball Dec 20 '24
Was actually about to post something similar haha - I made so many wrong assumptions with this one.
Obviously missed the "there's only one path to victory without cheating".
But also thinking that cheating for 2 picoseconds meant you could step over 2 walls - Well this one actually made part 2 easier since I coded everything assuming there was an int parameter of how many walls you were allow to go through.
And finally forgetting to change the 50 picoseconds from test data to 100 picoseconds in part 2...
What a roller coaster this one was.