Author Topic: AOC++  (Read 3551 times)

Ben T

Re: AOC++
« Reply #25 on: 28 December, 2017, 02:09:35 pm »
(click to show/hide)

(click to show/hide)
(click to show/hide)

Re: AOC++
« Reply #26 on: 28 December, 2017, 08:04:33 pm »
(click to show/hide)
"Yes please" said Squirrel "biscuits are our favourite things."

Re: AOC++
« Reply #27 on: 29 December, 2017, 01:25:08 pm »
OK here's a good one for you.

Did them all. First one quite simply, runs in 0.004sec.

Part 2 I get the answer in 11.3sec (thanks to using libgmp).

(click to show/hide)

Part 3 also rattles through in 84s (again thanks to libgmp).

It'd be a completely different story if I was trying to implement those without using a bignum library.

Part 2 can be partially optimised:-

(click to show/hide)

Will try and come up with my own puzzles in a bit. What I'll probably do is to extend the inputs of existing puzzles (from AOC 2015/16/17) to push them to the point that lots of optimisations have to be made for them to complete in a reasonable timeframe.
"Yes please" said Squirrel "biscuits are our favourite things."

Ben T

Re: AOC++
« Reply #28 on: 29 December, 2017, 03:57:21 pm »
That's good, yes I used the same lib, or the windows version of it MPIR.
Part 2 almost exactly the same as you (your better timings could be due to gcc being better at it than msvc which I'm using - what OS did you use?)
https://github.com/bjtaylor1/AoC2017/blob/bt1part2/BT1/BT1.cpp

Part 3 not sure if anything fundemantally faster than writing to stringstream but I could probably optimize by trimming all the zeros off the end
https://github.com/bjtaylor1/AoC2017/blob/bt1part3/BT1/BT1.cpp

You probably noticed that I sort of gave input numbers according to it running in a reasonable but not too quick time :)

Oaky

  • ACME Fire Safety Officer
  • Audax Club Mid-Essex
    • MEMWNS Map
Re: AOC++
« Reply #29 on: 30 December, 2017, 09:56:27 am »
Will try and come up with my own puzzles in a bit. What I'll probably do is to extend the inputs of existing puzzles (from AOC 2015/16/17) to push them to the point that lots of optimisations have to be made for them to complete in a reasonable timeframe.

In that vein,  there's an interesting one here based on day 25:-

https://www.reddit.com/r/adventofcode/comments/7mvtsb/2017_day_25_turing_optimization/
You are in a maze of twisty flat droves, all alike.

85.4 miles from Marsh Gibbon

Audax Club Mid-Essex Fire Safety Officer
http://acme.bike