[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: shortcut.gif (1.65 MB, 405x270)
1.65 MB
1.65 MB GIF
wario stadium edition

>Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. People use them as a speed contest, interview prep, company training, university coursework, practice problems, or to challenge each other.
https://adventofcode.com/

/g/ leaderboard join code:
796940-44255af5
anonymous-only leaderboard:
383378-dd1e2041

previous thread: >>103574248
>>
>>103583342
NIGGER
>>
>>103583354
you cannot say that on 4channel, the advertisers will leave
>>
day so boring idiomatic rust guy didnt try and first post his solution picture
>>
>>103583342
>20 long cheats are ultra shortcuts
Kino...
>>
bruteforcing all possible cheat steps takes too long. bruteforcing all possible wall cheat combinations takes too long. is it over for brutes? :(
>>
>>103583384
oh i see what you mean. i guess >>103583289 is right: sloppy problem statement. im not sure if it affects the final answer: probably not but hard to ve sure jut eyeballing my input
>>
anyone have that difficulty table? how did today's problem rate?
>>
>>103583401
Worked for me. What I did was:
>set up my grid
>do an initial walkthrough of the grid, recording the order of the steps
>iterate through each step. for each step, check against all remaining steps, calculate manhattan distance and stop the calc as soon as you see its >20
>check if dist < path dist, if so store in the output accordingly
>continue until done
The only optimization I had was only checking against the remaining steps, since a backwards cheat will never work so it's a waste to check for it. Still took like 20 seconds but totally doable. It might be faster to check just the 20 radius diamond around your square, and it'd be faster up until you have less than a hundred steps in the path but I was too lazy to implement that.
Fight on, brutebro
>>
>>103583445
16 minutes for leaderboard to fill, so a medium
>>
File: D20.png (669 KB, 2400x2942)
669 KB
669 KB PNG
>>103583342
Washed Kotlin.
>>103583401
>bruteforcing all possible cheat steps takes too long
Only if you actually recalculate the shortest path each time.
>>
File: image.png (431 KB, 1068x506)
431 KB
431 KB PNG
my humble BQN solution for day 20.

fumbled on gold but managed to get top 350 placement on silver. i think that's my highest placement so far. happy.
>>
File: img-2024-12-20-11-30-21.png (1.34 MB, 5600x4102)
1.34 MB
1.34 MB PNG
somewhat idiomatic Rust solution
>>
File: day20-mathematica.png (112 KB, 1647x1163)
112 KB
112 KB PNG
Fun problem.
>>
File: carbon(19).png (1.14 MB, 1986x1504)
1.14 MB
1.14 MB PNG
Haskell solution
Forgive me father, for i have brooted
>>
File: day20-mathematica.png (101 KB, 1647x1031)
101 KB
101 KB PNG
>>103583652
Minor wash, for autistic reasons.
>>
>queue
Aren't you guys aware that there is only a single path?
>>
File: 20.png (235 KB, 852x1050)
235 KB
235 KB PNG
slooow but simple day 20; just bfs for distances without cheats, then try all jumps of manhattan distance <= 20
there are some fairly obvious optimisations, but i'm happy with the aesthetics of my solution
Days              : 0
Hours : 0
Minutes : 1
Seconds : 10
Milliseconds : 686
Ticks : 706860700
TotalDays : 0.000818125810185185
TotalHours : 0.0196350194444444
TotalMinutes : 1.17810116666667
TotalSeconds : 70.68607
TotalMilliseconds : 70686.07

is this a broot?
>>
Day 17 can go fuck off, holy shit, what the fuck.
>>
>>103583796
>she can't grok 6 lines of code
>>
>>103583796
Day 17 is easy, though.
It might be impossible to hit the leaderboard, but it is trivial after some pen and paper solving.
>>
File: file.png (302 KB, 1726x1470)
302 KB
302 KB PNG
so how do you do it efficiently
>>
File: aoc24_20.png (274 KB, 718x1757)
274 KB
274 KB PNG
meh
>>
File: maxresdefault.jpg (57 KB, 1280x720)
57 KB
57 KB JPG
>a two-dimensional grid with coordinates
>>
>>103583862
you should be good at these by now...
>>
File: day20.png (33 KB, 759x352)
33 KB
33 KB PNG
BQN day 20

Pretty slow at ~5 seconds, but I think the simplicity makes up for it.
>>
>>103583888
wtf 5lines.
my shitty golang is like 150 lines.
very cute though
>>
File: img-2024-12-20-12-30-34.png (1.21 MB, 5600x3452)
1.21 MB
1.21 MB PNG
idiomatic Rust solution
>>
>>103583921
very disappointed. this is late
>>
>>103583915
meanwhile my bqn is 40 lines and takes 2 minutes and is wrong on the input despite getting the part 2 example exactly correct
>>
>>103583921
now post the calendar, faggot
>>
>another day where Eric haphazardly shit out a puzzle
if you can't deliver hand AOC over to someone else
>>
File: idioticrust.png (1.53 MB, 7915x4026)
1.53 MB
1.53 MB PNG
>>103583942
>>
>>103583406
No, it definitely changes the answer. consider again the example
###############
#...#...#.....#
#X#.#.#.#.###.#
#S#...#.#.#...#
#######.#.#.###
#######.#.#...#
#######.#.###.#
###..E#...#...#
###.#######.###
#...###...#...#
#X#####.#.###.#
#.#...#.#.#...#
#.#.#.#.#.#.###
#...#...#...###
###############

To move from X to X needs 10 moves (so you don’t intersect your own path) but Erik treats it as if it were just 8. This example doesn’t sink us because 10<=20. But now look in your input.txt for a similar situation, where the distance is 20 but you would need at least 22. My input.txt has lots of them. Erik didn’t account for this, but surprisingly I guess lots of AoC players also didn’t account for this. I’m still kinda mad it made me waste so much time, but life is life. Actually I am still mad, fuck you Erik
>>
>>103583975
If you are filtered just say you're filtered
>>
>>103583985
>To move from X to X needs 10 moves
wrong, that's 8 moves
>>
>>103583985
>(so you don’t intersect your own path)
why not?
>>
>>103584003
because he can't read
>>
>>103583997
It needs 10 moves because otherwise your path doubles back on itself. We know this isn’t allowed, because otherwise there would be an astronomical number of “time saving” paths where you walk back and forth in the same spot
>>
>>103584012
>We know this isn’t allowed
quote the problem description
>>
File: IMG_3997.jpg (31 KB, 500x475)
31 KB
31 KB JPG
>>103584004
>the retard is back
I thought I told you to go kill yourself faggot
>>
File: file.png (35 KB, 1038x132)
35 KB
35 KB PNG
>>103584012
>>
hey guys, what about 0-length cheats?
>>
>>103584019
>We know this isn’t allowed
because the answers (including the example answers) would be orders of magnitude higher if you could double the path up. the probem description says that cheat mode lets you pass through walls, it does not say you can break other rules
>>
>>103584003
>>103584004
do you count 0 length moves as part of the shortcut ?
>>
>>103584043
time only passes when you move
>>
I'm pretty sure I know how to finisu up solving the second part of today, I just need to sober up first.
>>
>>103584051
read this >>103584024
>>
>>103584053
liar i just wasted 5 seconds stationary to disprove you
>>
>>103584051
I don't get it. Each tile you move, 1 picosecond passes. By doubling the path up you are just wasting time.
>>
>>103584056
Ballmer Peak gone wrong?
>>
>>103584057
read this >>103584012
read this >>103583985
and especially read this >>103584022
>>
>>103584062
yes but in some cases you can double the path but still save more than 100seconds vs the normal time
>>
>>103584075
oh you're being filtered by this retarded shit because you didn't consider paths of length < 20...
you would never ever want to go back on yourself
>>
>>103584064
The secret ingredient is pruning.
>>
>>103584064
https://arxiv.org/html/2404.10002v1
>it's real
>>
>>103584095
if the block before the end is 5 moves away. and I can cheat up to 20 moves.
then i can move around the block before the end and approach from a different direction. then I have 1 more cheat that save more than 100 seconds.
>>
>>103584112
Dumb retard, cheats aren't time travel, they just allow you to move through walls. Each move still adds 1 picosecond to the timer.
>>
>>103584112
what part of
>cheats are uniquely identified by their start position and end position
do you not understand?
>>
>>103584095
i think this anon has misunderstood the concern; the doubling-back would not occur purely inside cheat mode; it would be that there is one or more tile you stepped on once in cheat mode and also once outside of cheat mode. in the example someone gave you would have to step on S twice and also on a second tile twice in order to use only 8 moves in cheat mode; otherwise you would need at least 10; and the suggestion is that there could be situations like this with 20->22 instead of 8->10
>>
>>103584123
sure, but if the cheat still save you more than 100 seconds, even if the cheat is 'longer', you can still count it? I am not talking about a cheat that is 'longer' and then save less than 100 seconds
>>
>>103584140
dumb retard
>>
>>103584124
S>>>E
V>>>^

there are two cheats still lest than 20 moves.
one approach from left, and other from bottom
>>
>>103584131
yeh something like this
>>
>>103584043
>what about 0-length cheats?
They are valid, but they do not decrease the shortest time.
>>
>>103583975
Be careful what you wish for, or you’ll be solving problems titled Tranny Medicine for Rudolphia
>>
>puzzle about cheating to save time on a race
llmtards really cheesed eric off this time
>>
>>103584250
> Sir please calm down
>>
Hmm, there should be 285 cheat paths in the example and I'm getting 255. I don't really get it.
I'm pruning any cheat paths where I am on the same position after the same number of steps from the same starting point.
>>
>>103584304
you can take more steps ( and still less than 20) and get on the same path.
so you just want the 'shortest' path for each cheat start / cheat end from each point in the path.
>>
Can anyone take a look at my part 1 onegaishimasu? It looks correct to me.

from collections import deque

def Day19(data):
silver = 0; gold = 0
matrix = [list(x) for x in data.strip().splitlines()]
cols = len(matrix[0])
rows = len(matrix)
walls = set()
start = tuple()
end = tuple()
for y in range(rows):
for x in range(cols):
if matrix[y][x] == "#":
walls.add((y,x))
if matrix[y][x] == "S":
start = (y,x)
if matrix[y][x] == "E":
end = (y,x)
def bfs():
q = deque([(start, 0)]) # ((y, x), steps)
visited = set()
while q:
(y, x), steps = q.popleft()
if (y, x) == end:
return steps
if (y, x) in visited:
continue
visited.add((y, x))
for dy, dx in ((1,0), (0,1), (-1,0), (0,-1)):
ny, nx = y + dy, x + dx
if not (0 <= ny < rows and 0 <= nx < cols):
continue
if (ny, nx) in walls:
continue
q.append(((ny, nx), steps + 1))
return float("inf")
total_steps = bfs()
tried = set()
for w1 in walls:
for dy, dx in ((1,0), (0,1), (-1,0), (0,-1)):
w2 = (w1[0] + dy, w1[1] + dx)
if w2 not in walls:
continue
if (w1, w2) in tried:
continue
walls.remove(w1)
walls.remove(w2)
if total_steps - bfs() >= 100:
silver += 1
walls.add(w1)
walls.add(w2)
tried.add((w1, w2))
tried.add((w2, w1))
print(total_steps)
print(silver)
return (silver, 0)
>>
>>103584332
>(y, x) instead of (x, y)
disgusting, stopped reading right there
>>
>>103584332
sir, we are on day 20 today. that is for yesterday
>>
>>103584332
can you save all your cheats and count them by the time saved list in the example?
that will help you see you are off by one. and that wll help for part2
>>
>>103584341
it's more efficient
>>
File: 1734584435081678.jpg (362 KB, 720x1280)
362 KB
362 KB JPG
>>
>>103584357
>guys my program is not producing the correct answer
>"you are using weird co-ords"
>its more efficient
>"but your program is still wrong"
>>
>>103584382
I want to flood fill her
>>
File: d20.png (661 KB, 1926x4066)
661 KB
661 KB PNG
Of course.
>>
>>103584382
guys help she chased input-chan and bigboy-chan out of my room and every night she fucking jumps me
>>
File: day20.png (369 KB, 1588x2394)
369 KB
369 KB PNG
$ mix run -e 'AOC.main()' -- 2024 20 b input/real
1521
1013106

Ran in 7033.192ms


Slooow. Really neat problem though.
>>
>>103584442
For a long time I was trying to BFS up to 20 steps off the path, but then I realised that the only important thing is can I get from one position on the path to another position on the path in a manhatten distance under 20 and save at least 100 picos.
>>
File: code.png (482 KB, 1552x3228)
482 KB
482 KB PNG
Python

I brute forced first and it took 1 hour and nine minutes for part 1.
>>
>wake up
>Example has one valid path
Let me guess, that's bait right?
I guess it doesn't matter for p1?!
This puzzle looks pretty dumb.
>>
>>103584560
same on the real one, its one straight path from start to end
>>
>>103584560
Have you tried reading?
>Because there is only a single path from the start to the end and the programs all go the same speed, the races used to be pretty boring.
>>
>>103583985
>>103584131
Hmm, it seems like this actually can happen. At least they included detailed numbers for the test case, so people will discover the true formula during testing. By the way, why did they say
>programs are racing, program can disable collision for 20 seconds
when they could have said
>reindeer are racing, reindeer can LEAP up to 20 squares in taxicab metric?
>>
>>103584594
wrong, retard
>>
>>103584607
What?
>>
>>103584624
it can't happen
>>
>taxicab grid question

Eric's done
>>
>>103584630
Why not?
>>
>>103584594
>taxicab
its call the manhattan distance.
Please educate yourself
>>
>>103584304
>after the same number of steps

Irrelevant. Cheats are defined by their start and end points, nothing more.
>>
>>103584652
>not calling it the metric induced by the 1-norm
Absolute mathlets.
>>
>>103584659
Yeah >>103584476
>>
>>103584145
NTA but these aren't distinct cheats. Read it again:
>cheats are uniquely identified by their start position and end position
Whether you approach from the left or the bottom in your example, you start and end from the same tiles, which is the only thing that matters.
>>
>>103584720
hmm oh. so thats why my answers were wrong
>>
File: day20.png (39 KB, 752x390)
39 KB
39 KB PNG
>>103583888
Changed to a faster calculation of manhattan distance table.
Now runs in 1.2 seconds, which I'm satisfied with.
>>
File: 1733887359530571.png (629 KB, 822x744)
629 KB
629 KB PNG
Is there a way to find cheats that isn't just BROOT'ing by checking the difference between every cell and its cheat-able neighbors?
>>
>>103584979
>Is there a way to find cheats that isn't just BROOT'ing by checking the difference between every cell and its cheat-able neighbors?
Yes, you map all positions to 3D space (x, y, length) and then use this to query the track positions that are cheatable.
https://en.wikipedia.org/wiki/Octree
>>
>>103584999
Elaborate?? I only know octrees from Minecraft.
>>
>>103584999
Please bear with me if these questions are stupid, but what does a tree have to do with this? I already create my 3D map by doing a BFS and marking the length of every cell. How would a tree speed up the checking when getting the potential cheat distance of every possible cell is just a lookup and a subtraction?
>>
Essentially, my approach for part one is to recycle some day 17 code:
1. Calculate the original distance S->E using BFS,
2. Count new shortest distances with a difference of >=100 from the original by first removing any one wall, then any two walls (horizontally or vertically)
I seem to be counting too many "good" cheats, is this a bug in my code or is my approach wrong?
>>
>>103584979
whats the larger image of that one you posted
>>
>>103585035
you do the position mapping, and then you start counting down
>>
>>103585039
>How would a tree speed up the checking when getting the potential cheat distance of every possible cell is just a lookup and a subtraction?
You have a point (x, y, length) and you need to get all points in (x-D..x+D, y-D..y+D, length+100..Inf).
Octree allows you to make these 3D queries and will return only the valid points. For maximum efficiency you also need to rotate X and Y axis 45 degrees so that the queries are aligned with the Manhattan radius.
>>
Fucking finally. That took forever. I have a headache and can barely read properly, so I thought it was a maze-like maze and not a modern game maze where there is only one path. When I realized that my program became radically easier and shorter.
>>
>>103584640
there is no reason why not. you can find these examples easily in the input. for example
#######################
#,E##################,,
#,###################,#
#,,,,,,,,,,,,,,,,,,,,#
######################

should have such a case, if i drew it right
>>
>>103585126
oh darn but close enough
>>
Another shit puzzle
>>
>>103585149
>Vec<Vec<char>>
stopped reading right there
>>
>>103585154
Objectively the best and most readable way to store the input.
>>
>>103584390
y,x is preferable to x,y when working on computers. This isn't a maths classroom.
>>
>>103585154
> let
nope. not reading
>>
>>103585173
wrong, see >>103583921
>>
>>103585178
did you find your problem yet?
and you are wrong
see >>103583921
>>
>>103585191
>and you are wrong
no, you are actually wrong
see >>103583921
>>
>>103585191
nta I'm >>103585149

My code is far better than the crap you linked
>>
>>103585083
you shouldnt remove two walls
when it says you can cheat for up to 2 seconds, that only actually gives you time to go past 1 wall as you have to enable it on a non-wall square
>>
>>103585196
just reject your prior knowledge and just learn from
>>103583921
>>
File: idiomatictrash.jpg (280 KB, 800x1137)
280 KB
280 KB JPG
This thread currently.
>>
>>103585216
if you would actually look at >>103583921, you would see that the y loop is the outer loop

>>103585231
wrong, see >>103583354
>>
>>103585231
basically every thread
>>
>>103585243
X'es is best'es. You go (x, y)
see >>103583921
>>
File: pop_00077_.png (1.88 MB, 1024x1024)
1.88 MB
1.88 MB PNG
Feels good to not be filtered
>>
>>103585261
name?
>>
>>103585261
>>103585267
miss. big feet
>>
>>103585267
sorry she's my gf I can't doxx her
>>
>>103585243
>(row, column) / (r, c)
>(x, y)
any other choice is wrong
>>
>>103585100
I don't know; it was posted as a reaction image here a few months ago and I saved it for advent of code purposes.
>>
>>103585335
I watched the show this week because people said it was good (it was average at best), but cant recall that
>>
>>103585271
You mean mr.
>>
>>103585326
>(i,j)
this is from an advanced maths topic called Matrix Theory
>>
>um your answer is too low
oh cool another retarded faggot day.
>>
>>103585351
i'll allow it
>>
File: Day20.png (200 KB, 1074x1569)
200 KB
200 KB PNG
C#. This is painfully slow, and certainly flawed as it gets a single cheat wrong for the example input, but it gave me the correct answer for the actual input so whatever.
>>
File: bison dollars.png (290 KB, 412x323)
290 KB
290 KB PNG
>>103585352
but to you, it is Wednesday
>>
>>103585352
just read all the text
>>
>>103585326
i'm an (r, c) guy, but if you use x and y you should use (y, x) not (x, y)
>>
>>103585399
no you shouldnt
>>
Can someone explain why you DON'T have to do this to get the answer?
>Once you have every node in the shortest path, for each pair of paths that represent a >= 100 picosecond save, determine if there is a path between them that uses a <=20 picosecond cheat period
Seems like people are using a Manhattan Distance which implies they aren't checking for any path, just the two most direct paths if I'm following
>>
>>103585405
because the "grid" only has one single path through it that contains every single non wall node
>>
>>103585405
there is some discussion about that in this thread. >>103583406
it seems like an oversight in the problem statement
>>
eric will be found dead tomorrow if he gives me another shitty puzzle
if its another gird i will rape his family in front of him first
>>
>>103585428
wrong, retards not being able to read != oversight in the problem statement
>>
>>103585399
please refer here for the correct approach
>>103583921
>>
>>103585397
I did. I even replicated the stupid example text. I realize it's a singular path + cheats obviously can't backtrack since that would add seconds.

I don't understand wtf eric is talking about.
>>
Such a poor problem description. Had to guess multiple definitions of what constitutes a valid cheat. Seems like everything goes, no matter how dumb, even walking back along the track.
Anyway, ~27ms both parts, C++.
>>
>>103585404
in (r, c) r is the vertical axis and c is the horizontal axis
in (y, x) y is the vertical axis and x is the horizontal axis
>umm but i'm used to (x, y) notation
you will confuse yourself with your stupidity; y will always be the vertical axis
>>
>>103585405
because you need to count the cheat paths
and a cheat path is defined by Start and END square. so the path between start and end dont matter
>>
>>103585441
you have not addressed the basic concern >>103584131
>>
>>103585405
The shortcut STARS and ENDS in points within the only possible path. The distance between them is 2.
>>
>>103585463
I cannot comprehend what is written there
>>
>>103585457
>umm akshually if you adhere to the cartesian coordinate system known worldwide and used by mathematicians everywhere, you will just confuse yourself
>>
>>103585410
>one single path through it that contains every single non wall node
doesn't seem to be the same as the problem statement
>Because there is only a single path from the start to the end
It's possible to have a single path from start to end, but still have '.' that aren't part of that path.
>>
>>103585477
>but still have '.' that aren't part of that path.
wrong
>The map consists of track (.)
>>
>>103585471
i just thought of a funny joke. but please, what would you like clarified?
>>
>>103585456
>had to guess what constitutes a valid cheat
try reading the problem description? a cheat is identified by its start and end position

>>103585472
yes, because you are using a list where the first index is the row (vertical axis), and the second index is the column (horizontal axis)
>>
>>103585346
My guess is that it's either fan art or porn of her.
>>
>>103585462
>>103585467
Isn't it possible, for a general grid, to have a roundabout path that avoids the <=20 cheat rule? But the standard taxicab doesn't?
>>
>>103585488
>a cheat is identified by its start and end position
which is meaningless.
>>
>>103585477
WRONG all the .'s are on the path in this contrived problem today
>>
>>103585490
sure. count it that way and see if you are correct.
try it and report back if you got your stars
>>
>>103585490
No for the input provided.
It is stated that there is only ONE SINGLE path.
>>
>>103585493
no, it means two cheats which start at X and end at Y and draw a swastika via convoluted paths are actually the same cheat
since you're counting cheats, that's important
>>
>>103585484
Isn't it possible to have track that doesn't lie on the shortest path? Assuming you could create a random grid. The problem doesn't say
>All track must lie on the shortest path
>>
>>103585515
>shortest path
There is only one path.
>Because there is only a single path from the start to the end and the programs all go the same speed, the races used to be pretty boring.
>>
>>103585511
>there is only a single path from the start to the end
this does not mean
>every '.' space must lie on the single path from start to end
>>
>>103585515
>is it possible to create a 3-D track and then map the problem?
sure, but its not the same problem we are discussing today
>>
>add 1 to my part1
>um that's the right heckin answer!
what the absolute fuck?
>>
>>103585495
thats true but at least they gave us a heads-up. it is a good reminder to LOOK AT THE INPUT
>>
>>103585525
>she only just solved part 1
um what the fuck?
>>
>>103585522
it does. I am declaring it as a FACT
>>
>>103585522
>this does not mean
The description states that '.' is the track. It is not possible for a '.' to not be part of the track because '.' is defined to be part of the track.
>The map consists of track (.) - including the start (S) and end (E) positions (both of which also count as track) - and walls (#).
>>
>>103585534
ya, I woke up like an hour ago.
>>
Another Eric Bullshit Classic (tm) where an efficient solution relies on a hidden property of the input. The worst kind of problem.
>>
>>103585542
you overslept by a lot
>>
>>103585545
>hidden
What's hidden?
>>
>>103585545
What property is that? My algorithm solves the general case.
>>
>>103585552
ya.. was drunk
>>
>>103585488
no i am not because im not a retard
i use a dictionary with tuples of the coordinates as keys as (x,y)
>>
>>103585545
I basically agree with you, but it's not hidden when the problem description says:
>Because there is only a single path from the start to the end and the programs all go the same speed, the races used to be pretty boring.
>>
>>103585561
he can't read with comprehension so he thought he was smart by looking at the input and deduce that all .'s form the one and only path
>>
File: fucks-sake.png (1.09 MB, 1194x710)
1.09 MB
1.09 MB PNG
>>103585568
>i use a dictionary with tuples of the coordinates as keys as (x,y)
>>
>>103585545
What's hidden? It says literally "it's a long an winding track" in the puzzle text.
>>
>>103585586
>It says literally "it's a long an winding track" in the puzzle text.
It doesn't
>>
>>103585568
if you need a tip how to structure your data correctly
see >>103583921
>>
>>103585594
not even going to try to read your tranny mess
>>
File: Capture.png (7 KB, 777x37)
7 KB
7 KB PNG
>>103585589
see
>>
>>103585602
>"it's a long an winding track"
>>
>>103585589
Paragraph 3:
"The race takes place on a particularly long and twisting code path"
>>
>>103585539
You are conflating the words "track" and "path".
>It is not possible for a '.' to not be part of the track
The problem never says this. It only says there is a single path.
>>
Pretty sure my C++ code solves the general case. Didn’t even realize there was only one path.
>>
>>103585614
see >>103585607

>>103585618
>The map consists of track (.) - including the start (S) and end (E) positions (both of which also count as track) - and walls (#).
>>
>>103585539
>It is not possible for a '.' to not be part of the track
ERIC NEVER SAYS THIS
LMFAO OWNED
>>
>>103585457
what the fuck are you tards arguing about?
if you don't have a datastructure to use (x,y) and get the right position, you're probably gay and retarded.
>>
>>103585628
see >>103585623

>>103585629
see >>103583921
>>
>>103585623
None of that says
>Every (.) must belong to the single path between (S) and (E).
That is an assumption.
>>
>>103585637
can the jannies do their job and ban the spammer?
>>
>>103585639
>When a program runs through the racetrack
>the racetrack
>>
>>103585202
wow, that was all it took.
>>
>>103585642
That doesn't say
>Every (.) must belong to the single path between (S) and (E).
It is possible to have unrelated track lying elsewhere.
>>
IT'S A BAD FUCKING PROBLEM U RETARDS
>>
>speed read text
>ignore non-bolded text
>still don't place anywhere near the global leaderboard
>sperg out on a forum that eric doesn't read
>>
>>103585629
see >>103583921
>>
>>103585651
wrong
see >>103585602

>>103585659
eric reads reddit
>>
>>103585663
Alright tranny we get it. That’s enough.
>>
>>103585667
>reddit
see >>103583354

>>103585670
>everyone is the rust tranny
>>
>>103585651
>The race takes place on a particularly long and twisting code path; programs compete to see who can finish in the fewest picoseconds.

>The map consists of track (.) - including the start (S) and end (E) positions (both of which also count as track) - and walls (#).

>When a program runs through the racetrack, it starts at the start position. Then, it is allowed to move up, down, left, or right; each such move takes 1 picosecond. The goal is to reach the end position as quickly as possible. In this example racetrack, the fastest time is 84 picoseconds.

>Because there is only a single path from the start to the end and the programs all go the same speed, the races used to be pretty boring.

There are no branches or alternate paths you could take. Starting at S, you can be sure that every adjacent . you meet is part of the one canonical track.
>>
>>103585675
I’m Squidward
>>
>>103585488
>a cheat is identified by its start and end position
Apparently....
#####
#S...
#####
#A...
#.###
#.###
#B###
#.###

Clearly, skipping from S to A is a cheat. But is moving from S to B a valid cheat, or just a dumb variation on the first one?
>>
>>103585678
CORRECT!
anyone trying to dispute this current does not have a job
>>
>>103585690
it doesn't matter, time continues ticking whether you cheat or not
>>
Eric lost.
###########
#........E#
#.####.####
#...##.####
###.##..###
#S..#######
###########
>>
>>103585667
>is wrong
>calls other people wrong
Whats with this guy lol. Anyway having special input is fair game, and we already saw some explicitly on the assembly-language question.
>>
>>103585690
S-B is a valid cheat however, it will be the same cheat delta as S-A
>>
I'm still trying to figure out what singular >=100 "cheat" I'm missing from my part 1....
>>
>>103585703
> Lets just make up a whole parallel question and related input and call other people wrong
sure you can do that, but that is not what is detailed in today's problem or input
>>
>>103585713
Fencepost error where the start/end tile isn't counted?
>>
>>103585706
>same cheat delta as S-A
Unless the track runs from B to A, then you are walking backwards while you could continue racing, which increases your time needlessly, which is dumb.
>>
>You are allowed to double-back, which counts as a distinct path, therefore there can't be any dead-end branches if there's only a single path from S to E.
Implied but not explicitly stated.
>>
File: file.png (309 KB, 1864x1470)
309 KB
309 KB PNG
tried writing a different algorithm than the O(n^2) compare every point in path to every other point in path
got down from 13s to 4s
is there any better way to solve it? 4s still seems too slow, but it is python
>>
>>103585736
sure, but he asked for cheat S-A and S-B. but you are correct
>>
File: img-2024-12-20-16-44-35.png (125 KB, 3168x412)
125 KB
125 KB PNG
thoughts?
>>
>>103585732
good point actually.... from start I don't think I check immediately behind me.
>>
>>103585740
why are you making up text that is not part of the problem?
>>
>>103585768
It's part of the problem. It's just not explicitly stated.
>>
>>103585719
I don’t disagree with you that the question contains a nice clue, or that we should look at the input. It’s just that what you are saying is strictly incorrect, and people have even drawn examples for you illustrating that it is strictly incorrect >>103585698
Like, what the hell?
>>
>>103585757
I didnt look at your code but:
> compare every point in path to every other point in path
You only have to compare against points on the PATH within a manhattan distance of 20.
so if you have a map of those points, its just a simple lookup for each point
>>
>>103585776
how do you get a map of those points without comparing all the points to each other to find their distance?
>>
>>103585757
for dy in range(-distance, distance + 1):
for dx in range(-distance + abs(dy), distance -abs(dy) + 1):

That way you can skip the manhattan distance check
>>
>>103585761
does not pass the smell test.
smells like llm.
>>
>>103585732
that was it.... kek, thanks anon.
>>
>>103585771
it is also not explicitly stated that the sky is blue, but just bringing it up does not help the problem.
Everything you need is defined the the problem statement text
>>
>>103585740
>>103585771
You are allowed to double back, but ONLY as the cheat move overlapping the non-cheat moves. You can’t have two overlapping non-cheat moves.
>>
>>103585782
it still needs to get the manhattan distance because its used when calculating time saved
>>
>>103585774
I am agreeing with you, but people making up other examples that's not part of the problem doesn't change the question as stated.
>>
>>103585798
so? you can get rid of the if, big performance boost
>>
>>103585678
If you have a tree and start from any node there is EXACTLY one path to any other node. That does not necessarily mean that every node is part of the path, only if rooting it somewhere wluld result in a leaf count of 1, then the path from of these nodes to the other indeed includes all the nodes. In any other case it DOES NOT. And the statement
>Because there is only a single path from the start to the end and the programs all go the same speed, the races used to be pretty boring.
is still true.
>>
>>103585778
when you first do a BFS through the maze you can keep a map of (x,y) = distance.
where distance increase by one for each tile you walk.
then you have your map you can use for lookups.
>>
damn, /g/ got BTFO by a poojeeta
https://github.com/MahaZainab/Advent-of-Code-2024/tree/main/Day%2020
>>
>>103585815
that is literally what im doing, and its not the manhattan distance
>>
>>103585794
correct
>>
>>103585774
Wrong. That example is invalid and would not be allowed by the question statement.
>>
>>103585822
that map is not the man-dist.
what you do next is loop over all (x,y) blocks in the path, then add all the dx,dy delta points to that x,y that is inside a 20 man-dist of x,y.
now you have newx,newy. you lookup newx,newy up in your previously build map.
and get the distance to the end. subtract the distance to the end at your current location (x,y) and the man-dist. to get the 'saved' seconds amount.
>>
>>103585841
theres no fucking difference between what you are suggesting and what the code is already doing other than you storing it in a map for no reason
>>
>>103585821
the code is empty
>>
>>103585841
cont. you dont have to compare every point on the path to every other point in the path. what I described above is 'less' bruteforcy
>>
>>103585811
The question doesn't say there's "exactly one path between two nodes", it says there's only one path full stop. Trees can have branches, but the problem statement doesn't allow branches.
>>
>>103585851
exactly
>>
guys
just admit it was a SHIT problem
>>
>>103585850
you said
> compare every point in path to every other point in path

well. I suggested a method where you dont have to do that. only compare a point to points within 20 man-dist.
>>
>>103585810
you right it went from ~3.8 to 3s
im still wondering if theres a better algorithm to get it under 1s
>>
>>103585851
you just do not understand the elegance of:
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
>>
>>103585867
yes, rewrite it in Rust. 35ms
>>
>>103585815
>BFS through the maze

Maze? It's a path. From S until E there's always exactly one new tile you can move to.
>>
>>103585862
how about this part right before that
>tried writing a different algorithm than
this means that i wrote something which is NOT that O(n^2) algorithm
>>
>>103585821
>not actually on the leaderboard
You have a crush on this chick or something? She’s not bad looking, for a brown stem academic.
>>
>>103585867
for more improvements
see >>103583921
>>
>>103585886
kys
>>
>>103585883
>>not actually on the leaderboard
???
>>
>>103585878
yes correct. that was my fault
>>
>>103585888
Oh theres a daily leaderboard too
>>
>>103585880
yes, I am agreeing with you
>>
>>103585861
It was a shit problem. But on both an intuitive level and an autistic level, the question statement implied a single path. No branches, no dead ends. Using BFS or DFS or Dijkstra is dumb and suggests a lack of intelligence/understanding.
>>
>>103585855
If you removed the "from the start to the end" part you would be right.
>>
>>103585867
Run BFS to get the noncheat distance for every cell
For every ‘.’ cell, find every other ‘.’ cell with a 20 manhattan distance
Add the distance from the start to the first ‘.’, the distance from the second ‘.’ to the end, and the manhattan distance between the two ‘.’s.
If that new distance you calculated saves 100 steps or more, increment the answer.
Mine runs in 90ms with that algo.
>>
>>103585821
is this /ourgirl/
completed more days than timeenjoyed
>>
>>103585913
thats what mines doing right now
>90ms
what lang?
>>
>>103585913
>find every other ‘.’ cell with a 20 manhattan distance
retard
>90ms
not python
>>
>>103585924
C++
>>
what technique did you use to move through the path and generate a distance for each tile from the start to the end?
>>
>>103585929
makes sense
>>
>>103585930
a BFS without a queue
>>
>>103585913
yes this is correct.
>>
>>103585928
*within
sorry pythonlet
>>
>>103585936

sorry wanted to ask >>103585905
what did you use?
>>
>>103585952
a BFS without a queue
>>
>>103585952
>Using BFS or DFS or Dijkstra is dumb and suggests a lack of intelligence/understanding.
>>103585957
so.... how did this happen?
>>
>>103585961
a BFS usually uses a queue
>>
>>103585968
what is BFS with a stack?
>>
>>103585977
a DFS
>>
>>103585637
see >>103583354
>>103585183
see >>103583354
>>103585191
see >>103583354
>>103585196
see >>103583354
>>
>>103585991
are you happy doing that?
>>
>>103585243
see >>103583354
>>103585257
see >>103583354
>>103585594
see >>103583354
>>103585623
see >>103583354
>>
>>103586004
yes
>>
>>103585637
see >>103583354
>>103585663
see >>103583354
>>103585667
see >>103583354
>>103585675
see >>103583354
>>
>>103585991
>>103586005
>>103586018
Based
>>
so, how do you handle 0 cheat lengths?
>>
>>103586040
see >>103583921
>>
File: carbon.png (1.02 MB, 1792x4388)
1.02 MB
1.02 MB PNG
day 20                  time:   [7.6890 ms 7.7022 ms 7.7157 ms]

Wew, one of the longer runtimes for me this year.
First part I iterate over all squares to the right and within range, part 2 is bruteforce but I skip chunks of tiles instead of doing them one by one.
Did anyone try a tree approach? I tried a kd-tree but it was comparable to checking all tiles within 20 squares. Maybe my implementation was bad, but scipy's one was also pretty terrible.
>>
>>103586040
I process them like any other potential cheat. It won’t improve your score at all so it doesn’t matter.
>>
File: im-1734711216687.png (119 KB, 684x869)
119 KB
119 KB PNG
solved part 1 before leaving for kids christmas program. when I tried modifying for part 2 I got the wrong answer. sitting in christmas program thinking about what was wrong, realize i'd hardcoded a "+ 2" and it needed to be "+ manhattan dist". Rush home and get 2nd star.
I'll have to look at the other solves but mine does a BFS from start and from end, then iterates pairwise to see if a shortcut through two points will save us time.
>>
>>103586055
see >>103586057
if you want to improve your code in order to run faster
>>
>>103586079
it already is plenty fast considering I run it on an old laptop
>>
>>103586090
you better catch it before it runs away!
hehe
>>
>>103585757
I had an idea
rather than recalculating the points within distance for each point, you could maintain a window of the points in 20 distance around current location, then just add 1 in whatever direction you travel as you follow the path
>>
>>103586133
see >>103586057
>>
>>103585886
see >>103583354
>>103586055
see >>103583354
>>103586079
see >>103583354
>>103586141
see >>103583354
>>
File: idiomatic_calendar.jpg (3.76 MB, 7953x4024)
3.76 MB
3.76 MB JPG
see this
>>
ok. that was actually easy.
other than the oopsie poopsie for part1, 2 was basic as fuck. hell, rewriting 1 to use 2 fixed my other fuck up too.
>>
>>103586160
correct
>>
What the hell happened to /aocg/?
It is day 20 and people are tripping out?
>>
>>103586186
yes we mad
>>
File: img-2024-12-20-17-28-17.png (1.09 MB, 6016x2060)
1.09 MB
1.09 MB PNG
>>103586186
>>
File: aocg_day20.png (486 KB, 640x480)
486 KB
486 KB PNG
current mood
>pic rel
>>
>>103586233
do NOT cross the picket line!
>>
>>103586205
AI chuds?
>>
>>103586259
no, just skill, see >>103585821
>>
>>103585821
the notebooks aren't loading for me.
>>
>>103585917
I kneel to pooja supremacy.
>>
>>103586205
Well I for one like an easy AoC Year.
I got very little time.
>>
>>103586276
they are empty
>>
>>103585821
>posted her input.txt
That will be $150,000+tip
>>
>>103586259
sorry I meant
see >>103583921
>>
>>103586308
someone has to stop Eric sama's lawyers!
>>
So now that AoC has concluded its 10 year run, what do we think?
>>
>>103586276
see the content of the solutions here
>>103585873
>>
>>103586310
why are you being such an obnoxious homosexual? I'm sure your solution is beautiful and idiomatic, but please. stop.
>>
>>103585873
True elegance. Wow.
>>
>>103586324
>every anon is the rust tranny
>>
>>103586295
oh.
idk nothing about jupyter or whatever. I didn't even know shithub could run them.
>>
>>103583445
https://aoc-stats.fastbee.box.ca/
piss easy
>>
my cheat does not work
hmmm
>>
File: 1732404119492593.jpg (487 KB, 1236x1648)
487 KB
487 KB JPG
RecursionError: maximum recursion depth exceeded


sys.setrecursionlimit is wont unfuck me. Works on example input. It's over...
>>
>>103586379
>no trigger discipline
uh oh
>>
>>103586133
somehow this is slower... i guess the memory usage from holding all of the points at once is too much?
>>
>>103586233
Needs Santa hats.
>>
File: file.png (32 KB, 693x347)
32 KB
32 KB PNG
>>103586391
nevermind you dont actually need to hold all of them in memory if you do it at the end when checking cheat paths
full second saved
although now my answer is slightly wrong so i probably broke something else at the same time
dunno if i can be bothered trying to make it any faster
>>
>>103586460
that 1 should be a 20 i just put it there to see if it was doing what i expected
>>
>103583438
43 seconds on my original code. I realized it was because I was using IndexOf() to get a position's value. Adding a dictionary got it down to about 4 seconds as well lol.
>>
>>103586488
>>103583438
>>
>>103586402
its open source, pull requests are welcomed
>>
Example input of part 1:
I can't detect the cheat to save 40 cycles.
I detect two cheats that save 64 cycles, but it's probaly the same cheat. So far I only set when the collisions are off, I don't identify the postion.
>>
>>103586531
ok nice. do you get the number and count up, or do you count down?
>>
>>103585439
Excluding day 2 (a non-grid problem) and day 15 (a grid problem on an even-numbered day) every even-numbered problem has been a grid problem, so this trend may continue for days 22 and 24
>>
>>103586551
I count up. It's legal to go into a wall/be in a wall at cycles n and n + 1
>>
File: 1732781984087824.webm (2.24 MB, 352x640)
2.24 MB
2.24 MB WEBM
>>103586571
>this trend may continue for days 22 and 24
>>
>>103586531
The 40 cycle save is the jump from (7, 7) to (7, 9), counting the top row as y = 0
>>
Why is everyone seething? Part 1 I accidentally myself, but it didn't matter for part 2 anyways.
>>
File: heatmap.jpg (50 KB, 1218x472)
50 KB
50 KB JPG
>>103586205
explain this then
>>
>>103586626
>globetard "proofs"
>>
>>103586626
Can someone with autism explain this dog shit visualization?
>>
>>103586641
conservative / liberal in-group / out-group preference
>>
File: aocg_day20.png (486 KB, 642x476)
486 KB
486 KB PNG
>>103586402
eric please save us
>>
>>103586596
sorry I did the count down method, I cant help you
>>
>>103586657
quickly explain the countdown method to me
i'm at my wits end and will be filtered if i can't solve this problem in the next 2 hours
>>
>>103586664
you go through the path and count the squares from start to end.
Then for each wall, if there is a path next to it, you use the count you got in the first pass, and count down to get the 'seconds saved'
>>
>>103586675
okay but what if i count down the path from the wall and it's shorter than the squares down from the end?
>>
>>103586664
start with all possible (r*c)^2, count down
>>
>>103586701
that sounds correct. gl
>>
>>103586711
cheers, i'm ~~counting down~~ counting on you, anon
>>
>>103586664
ok really.
see here for steps
>>103583448
and see here for idiomatic solution
>>103583921
>>
>>103586664
checked
>>
>>103583937
it takes 2min now and is much shorter
my wrong answers are so much faster, it's really satisfying
>>
>>103583448
>since a backwards cheat will never work so it's a waste to check for it
That's what I did. during the initial traversal, once I was 100 steps in I checked that point against all previous points atleast 100 steps back and with the given distance. Then I just added together all the ones that saved enough time
>>
>up to 2 picoseconds
this means I can skip two walls, right? First wall at cycle n, second wall at cycle n+1
####
.##.
####
>>
>>103586951
no
>>
This was a really bad problem. The real challenge was trying to understand what the problem creator tried but failed to ask properly.
Just the fact that cheats have a start and an end position but the examples don't mark the start position (they start counting at 1 instead of 0) is pretty bad.
My first thought for part 1 was that since you can cheat for 2 tiles, you can pass through 2 adjacent walls. But actually "you can cheat for 2 tiles" means "you can teleport from one empty tile to another empty tile 2 steps away, and we don't show the starting tile on the examples". If the problem talked about teleportation instead of "passing through walls", it would make much more sense.
>>
>>103586951
>At the end of the cheat, the program must be back on normal track again; otherwise, it will receive a segmentation fault and get disqualified.
>>
>>103586951
max 1 wall skip for part1
>>
File: file.png (399 KB, 1756x1774)
399 KB
399 KB PNG
>>103586460
SOLVED
i was ignoring shortcuts starting at the first point
2seconds in python
all that effort and 2 seconds is the best it can do, what a shit lang
>>
>>103586984
nice
>>
>>103586967
cheat ends after two cycles, and I'm on the other side by then
hmm
>>
>>103587032
It's a really badly stated problem. It only gets worse.
>>
>>103586964
this
>>
>>103587032
>activate cheat while on track
>move into first wall
>move into second wall, cheat used up
>segfault
>>
I nominate this problem for worst problem out of all 10 years of AOC
>>
>>103587056
no, that would be 2023-25
>>
>>103587069
Fuck you that was a fun problem.
>>
>>103586498
maybe it would be faster to run my FindShortcuts only once, having two List/Set with shortcutLength <=2 and <=20 and return the count
>>
What actually happened this year is that Eric has a set of the first 5 problems for each year for 2024-2028, and he accidentally put them all into one year instead of spreading them out
>>
>>103587147
>2025-2028
anon... how do I tell you this? Someone else please do it, I can't bear to do it.
>>
>>103587147
this is the last aoc anon
>>
>>103586964
I didn't really have any problem understanding the challenge, but my suspiciously high rank today does make it seem like it was hard for others. Guess I must be on the same wavelength as Eric.
>>
>>103587051
>>103587038
I expected it to be an edge-triggered case
two clock cycles means you can cross into illegal state twice

advent of getting esl'd strikes again.
>>
>>103586889
finally
it really helped to put the problem aside and focus on my terrible performance. I was checking every single dot every single time in propagate instead of following the straight path.
I still have no idea why my window-like Cheat2 isn't doing the same thing as the dumb Cheat3
>>
File: bqn.png (193 KB, 1360x1069)
193 KB
193 KB PNG
>>103587203
>>
>>103587177
objection: speculation
>>
File: ngmi.jpg (124 KB, 1086x1080)
124 KB
124 KB JPG
>>103587214
>using dirs instead of
-⊸∾⊸⋈0‿1

ngmi senpai
>>
>>103587069
Eh, the bar for Christmas Day puzzles is pretty low to begin with and for an "implement this algorithm" puzzle it's at least novel compared to a Dijkstra or something
>>
oh, now I get why I can't find the 40 cycle shortcut.
I count up. And on that cycle I can also go straight to finish, so that's it.
I'll try going from finish to start and we'll see what happens
>>
File: 24_D20_v2.png (401 KB, 2372x1902)
401 KB
401 KB PNG
>>103587108
Yeah, part 1's basically free if you store it in part 2
I implemented that alongside for loop instead of IndexOf() and got the time down to 1.6 seconds
>>
no bigboy for today?
>>
>>103587334
>dictionary, list
i raise you an array and a queue
>>
File: day20_faster_2.png (210 KB, 871x1900)
210 KB
210 KB PNG
got my time down to 2ms parallelized by using symmetry (exploring only upper half of diamond).
tried a solution keeping track of the set of distances within the half-diamond only doing boundary updates, but it was way too slow (used a fenwick tree for range queries; maybe a sortedset is faster?)
>>
>>103587267
look we have a rune master here
>>
File: bqn.png (8 KB, 450x103)
8 KB
8 KB PNG
>>103587267
I've only done five days in BQN
>>
>>103587397
neat2
>>
guys.
do you have your grid parsing and navigating loops ready for tomorrow?
get them ready!
>>
File: a.png (4 KB, 446x58)
4 KB
4 KB PNG
>>103587427
you missed the reverse in the middle
>>
>>103587439
yes babe i have dx = ((-1, 0), (0, +1), (+1, ... and even dxx in my template
can't wait to do the humiliation ritual again:
for dr, dc in dx:
rr = r + dr
cc = c + dc
if not (0 <= rr < rows and 0 <= cc < cols):
break;
...
>>
File: solve.png (776 KB, 5654x3062)
776 KB
776 KB PNG
got my idiomaticity up to 23
>>
>>103587530
shouldn’t it be continue
>>
Why do you guys hate grids so much? Do you want a 1d problem instead?
>>
>too low
oh come on
>>
>>103587381
oh shit, you're right. a dictionary is kind of redundant given my noclips array. That saved 100ms.
I'm not sure about the queue though. With my code I'd have to cycle the entire queue instead of just checking 100 steps back
>>
>>103587572
yes, i wasn't paying attention to my 4chan post
>>
>>103587576
it's just annoying
>day 3, grid
>whip together bfs or dijkstra's or something
>finish
>day 4, get rid of previous solution, start anew
>day 14 grid again
>ugh should have saved that pathfind function
>save it this time
>....
>day 23
>grid again but with a twist so you can't even use that path finding anymore
grid puzzles are lazy because they are easy to design
>>
>>103587576
there's just so many days that boil down to "traverse this 2D grid" that it gets really stale really fast
you don't need a 2D grid to make an interesting problem, I would much rather take days like pebbles (day 11), assembly (day 17), or towels (day 19), than days like walk this maze (day 16), walk this maze (day 18), or walk this maze (day 20)
>>
>>103587620
>get rid of previous solution
¿
>>
>>103587620
you coding on an Etch-a-Sketch or something? why are you getting rid of anything?
>>
>>103587570
wrong
see >>103583921
>>
>>103587650
I code everything from scratch each day. No regrets.
>>
>>103587620
>>103587668
learn git
>>
>she has replied "wrong, see: >> 103583921" 15 fucking times
could we get idiot tranny b&?
>>
>>103587678
Not regretting starting from scratch.
feels good to create an artisanal solution everyday without being shackle to mistakes of the past.
You just won't get it.
>>
>>103587638
>>103587650
>>103587678
the only aoc stuff i've saved is related to intcode and I have a utility to grab the input, but that's it
>>
File: bruhcode1.png (17 KB, 855x87)
17 KB
17 KB PNG
>>103587728
I hope you saved your computer from the other day
>>
>>103587633
don’t worry insider here
we’re gonna give you another 2023-21-2

and some Pick’s Theorem questions just for shits and giggles
>>
>>103587397
pretty based for a rust user
>>
>>103587820
>we’re gonna give you another 2023-21-2
so the general case is impossible to compute, but the real input has some weakness that makes it trivial?
now i know what i'm looking for it won't be a problem
>>
>>103587795
i'll just write it again then
>>
wasted so much time because i misunderstood what counts as valid cheat path
turns out it works if you do it in the dumbest way possible
>>
File: 1647106093248.gif (1.55 MB, 350x258)
1.55 MB
1.55 MB GIF
what we haven't had yet:
>automata / rpg / simulation
>line segments / sweep lines shit
>sea monster / 3d cube / general wtf puzzle
>maths trick puzzle
>???
last two days have been pretty stupidly easy compared to previous years, is this the calm before the storm is unleashed and we will pay for our hubris? or are we just jogging through the final week victory lap before eric fires a parting salvo at the llmfags and announces he's quitting?
all this lorefagging and history crap is weak. fuck recap episodes.
>t. does it for the lore
>>
>>103588434
tomorrow will be dijkstra
>>
>>103588434
>sweep lines
day 8 part 2?
>>
>>103588434
I guess the sokoban puzzle counts as this year's sea monster / tetris equvalent
>>
>>103588615
sokoban was easy though
>>
>>103587381
so implementing one queue to store all the nearby points and another for the points that could potentially save the 100+ steps got my runtime down to 850ms
The only thing faster would probably be generating a diamond and then filtering by traversed points
>>
>>103588434
the arcade claw machine was kind of a maths trick puzzle? obviously not a very hard one, but considering the general difficulty of the year, that's probably this year's designated maths trick puzzle
I'm still holding out that the last couple days are the actually interesting puzzles, but the entire month I've been telling myself "tomorrow's the great filter for sure" and then it's just a medium/hard puzzle at worst
I wouldn't be too surprised if there aren't any puzzles more difficult than anything else we've seen this year, followed by eric saying "hope everyone enjoyed a more relaxed AoC this year, because it was the last..."
agreed with the story too. there isn't really one, every day is just "you meet up with [character in previous year], now here's the unrelated puzzle description"
>>
NEW THREAD
>>103588803
>>103588803
>>103588803
>>
>>103587397
For the second part, it was faster for me to iterate over pairs, skipping the second point if possible. That takes around 7ms. Checking half of the area for part 1 is very fast, takes ~180µs, but for part 2 it goes up to 12ms.
I think trees are slower for today's input, because it's so densely packed. It's around 9500 / 19600 tiles so you have what, 400 tiles in range of each point?



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.