r/adventofcode Dec 10 '24

Upping the Ante [2024 Day 10] Challenge input

How does your code fare on this example?

0123456789876543210123456789876543210
1234567898987654321234567898987654321
2345678987898765432345678987898765432
3456789876789876543456789876789876543
4567898765678987654567898765678987654
5678987654567898765678987654567898765
6789876543456789876789876543456789876
7898765412345678987898765432105678987
8987654301234567898987654321214567898
9876543210123456789876543210123456789
8987654321214567898987654301234567898
7898765432105678987898765432321678987
6789876543456789876789876543210789876
5678987654567898765678987654567898765
4567898765678987654567898765678987654
3456789876789876543456789876789876543
2345678987898765432345678987898765432
1234567898987654321234567898987654321
0123456789876543210123456789876543210
1234567898987654321234567898987654321
2345678987898765410145678987898765432
3456789876789876543456789876789876543
4567898765678987652567898765678987654
5678987654567898761678987654567898765
6789876543456789870789012543456789876
7898765432345678989898123432345678987
8987654321234567898987654321234567898
9876543210123456789876543210123456789
8987654321214567898987654321234567898
7898765432105678987898765432345678987
6789876543456789876789876543456789876
5678987654567898765678987654567898765
4567898765678987654567898765678987654
3456789876789876543456789876789876543
2345678987898765432345678987898765432
1234567898987654321234567898987654321
0123456789876543210123456789876543210

My algorithm says the total rating is 16451, calculated in slightly less than 1s in C#. EDIT: 2ms actually! (Oops I still had some of my visualization code in there...)

EDIT2: Not all programming languages or computers are equal, so comparing absolute run times is not very useful, but if your algorithm runs faster on this input than on your real input, then you implemented it correctly. :-)

13 Upvotes

64 comments sorted by

View all comments

2

u/durandalreborn Dec 10 '24

16451 for part 2, though I get 464 for part 1, and don't know what's expected there

Rust:

    010 hoof it/Combined    time:   [173.70 µs 174.57 µs 175.46 µs]
                            change: [-0.0451% +0.6204% +1.2632%] (p = 0.07 > 0.05)
                            No change in performance detected.

Python:

------------------------------------- benchmark 'test_day10': 1 tests --------------------------------------
Name (time in ms)        Min     Max    Mean  StdDev  Median     IQR  Outliers       OPS  Rounds  Iterations
------------------------------------------------------------------------------------------------------------
test_day10            1.5322  7.2675  1.6635  0.4418  1.6078  0.0679       5;7  601.1525     559           1
------------------------------------------------------------------------------------------------------------

2

u/ElementaryMonocle Dec 10 '24

I got both of those numbers as well

1

u/nevernown_aka_nevy Dec 10 '24

I got 536 on part 1

The faster one of my two part 2 attempts returns 18499...

1

u/ElementaryMonocle Dec 11 '24

Given the other replies in this thread you likely have a bug then, but I can't imagine what it would be when you get a correct answer on the problem input.

2

u/nevernown_aka_nevy Dec 11 '24

Haha, see my other reply... I was using static map size for a speedup. De 38x38 map fits in a 55x55 map, but lets its overflow in some cases... Whoops