Well...I didn't understand this sentance quite good - "This also means that the elevation of the destination square can be much lower than the elevation of your current square"
How much lower? If 1 to go up then maybe 1 to go down? or 2 max?
So tried it with 1, couldn't get the result, so I changed that they can jump to their death from z to a...and it worked
Maybe tommorow it will start with "some of the elfs didn't survive the jumps" :)
Yeah, yesterday I made a program that run an hour, trying to do bfs as a djikstra algorithm with a path length of one. I got the answer in an hour, then found out bfs isn't programmed recursively, but with a queue and now it runs in half a second.
Thank you for this! I spent five hours today banging my head against a wall unable to figure out why my pathfinding algorithm was returning a failure. I thought you could only go up OR down by a single level. I took a short break and looked at the memes on here and figured out what I was doing wrong.
Somehow I managed to get the right answer only allowing up or down by at most one.... I wonder if there was a second bug in my code that cancelled it out lmao.
I had spent hours looking for the error when I read the problem statement again and realized that. It didn't seem very logical (but quantum mechanics applied to ropes don't either, right?
89
u/AlexAegis Dec 12 '22
crude mspaint art > ai generated stuff
16
u/kristallnachte Dec 12 '22
And somehow for it to be a hiking trail they need to go both ways......
30
u/ra3_14 Dec 12 '22
So true, this messed with me so much when I made the reasonable realistic human assumption that the absolute different in heights could at most be 1.
5
u/zelarky Dec 12 '22
Found out that my lowest destination on the way is just -2 from the current. Seems like nobody would break their legs
2
u/czerwona_latarnia Dec 12 '22 edited Dec 12 '22
For a moment that was how my part 2 was working like (with starting from the end).
Let's just say that the path to closest 'a' high was VERY short.
2
u/aaronblohowiak Dec 12 '22
i burned 2 hours on this last night... missed that part of the prompt somehow.
3
u/IvanOG_Ranger Dec 12 '22
I spend an hour making a non-functioning djikstra algorithm, I hope the elves die
1
u/poesraven8628 Dec 12 '22
Thank you for this! I spent five hours today banging my head against a wall unable to figure out why my pathfinding algorithm was returning a failure. I thought you could only go up OR down by a single level. I took a short break and looked at the memes on here and figured out what I was doing wrong.
1
u/[deleted] Dec 13 '22
I totally didn't spend 45 minutes plus debugging my algorithm because I thought we only step down by one...
1
u/Grabthelifeyouwant Dec 13 '22
Somehow I managed to get the right answer only allowing up or down by at most one.... I wonder if there was a second bug in my code that cancelled it out lmao.
1
u/Tom70403 Dec 13 '22
I had spent hours looking for the error when I read the problem statement again and realized that. It didn't seem very logical (but quantum mechanics applied to ropes don't either, right?
1
u/DudeWheresMcCaw Dec 13 '22
I thought that you could only go up, and that I was given an impossible input. π΅
1
u/crhallberg Dec 16 '22
Thank you so much for this. I really thought I had a bad input and missed this detail! SOLVED!
1
u/GiNgErMaN- Jan 01 '23
this had me stuck for 30 minutes 3rd grade reading comprehension not my forte apparently