this post was submitted on 03 Dec 2024
22 points (100.0% liked)

Advent Of Code

977 readers
76 users here now

An unofficial home for the advent of code community on programming.dev!

Advent of Code is an annual 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.

AoC 2024

Solution Threads

M T W T F S S
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25

Rules/Guidelines

Relevant Communities

Relevant Links

Credits

Icon base by Lorc under CC BY 3.0 with modifications to add a gradient

console.log('Hello World')

founded 1 year ago
MODERATORS
 

I was looking through the global leader board for day 3 today and noticed that the first 100 results are all under 90 seconds, with the top 4 being under 30 seconds. How is that possible? What are people leveraging in order to accomplish this?

all 13 comments
sorted by: hot top controversial new old
[–] Maddier1993 11 points 2 weeks ago* (last edited 2 weeks ago)

Professional code golfers (Is that the right term?) build up a large suite of helper libraries from past events/from daily puzzle solving that they invoke for common problem types like graph search or constraint solving, or even for converting the text input to the right data structures.

I assume the most difficult aspect of the problems is to translate the statements into actual code constraints/filter functions. So the spirit of the competition is not broken by having pre-written code (Although I am not sure many would think pre-written code is acceptable).

[–] [email protected] 10 points 2 weeks ago

Practice. I’ve seen some recordings of top solvers in the past. They pretty much know exactly what to write, and they type really fast.

[–] [email protected] 9 points 2 weeks ago

See for yourself! This is someone solving day 1 of this year:

https://youtu.be/ym1ae-vBy6g?si=jbjfMMsxMveKrbLS

If you're really going for it, you can automate some of the busy work like getting the input file and a template that's ready to read it in and split it into lines, then it's mostly a matter of skimming for what to do and knowing how to zip/map/fold/reduce/etc the data quickly. I was a bit surprised to see him having to add imports to his file, I'd think he'd have those ready to go, and of course quitting out of Vim to run the script isn't necessary either, but I can't judge because I definitely do that too...

[–] [email protected] 8 points 2 weeks ago

Yeah, you could automate it, but that's going against the spirit of the event. And if you can automate guessing, why not just try to solve the challenge?

They're probably using AI. It's technically cheating, but I wouldn't personally hold it against them since nothing really seems to be at stake.

[–] [email protected] 5 points 2 weeks ago (2 children)

Thinking about it a little more, the answer is a number, and the site tells you if you are too high or too low, so a modification of a binary search might be the answer? I'm not sure if there is a submission limit but if there isnt then that could result in a fast submission.

Say the answer is 400 and you guess 100, the site tells you it is too low, you guess 1000, the site tells you its too high, now you know its between 100 and 1000, so you can narrow it down with a guess in the middle until you get to the answer. With some automation this would be pretty quick but it would defeat the point of the challenge.

[–] [email protected] 11 points 2 weeks ago (1 children)

The timeouts are 1 minute for the first 5 attempts, then 5 minutes.

People are just really used to AoC's format and use languages/frameworks that are extremely concise

[–] [email protected] 5 points 2 weeks ago (1 children)

That is impressive, I think it took me more than 30 seconds to get the regex I wanted to use correct, more or less the rest of the solution. This is my first time doing AoC or anything like it so I wasn't expecting to be anywhere near the top, but the times I saw there were shocking.

[–] [email protected] 4 points 2 weeks ago

There are a lot of people participating. Some of 'em are bound to be really really good, and also get lucky!

[–] UndercoverUlrikHD 9 points 2 weeks ago (1 children)

I haven't had time for the AoC yet, but if it's like last year, there are rate limits that would make binary search ineffective.

[–] [email protected] 1 points 2 weeks ago (1 children)

Ah yeah, if you can only submit once every 30 seconds or something that would defeat the ability to binary search, at least at the speeds that people were submitting today.

[–] UndercoverUlrikHD 4 points 2 weeks ago

The timeouts become greater the more times you submit an incorrect answer

[–] [email protected] 4 points 2 weeks ago

Last year, there were lots of AI solutions and they got it in like 3 seconds once.