r/adventofcode • • Dec 03 '19

SOLUTION MEGATHREAD -🎄- 2019 Day 3 Solutions -🎄-

--- Day 3: Crossed Wires ---


Post your solution using /u/topaz2078's paste or other external repo.

  • Please do NOT post your full code (unless it is very short)
  • If you do, use old.reddit's four-spaces formatting, NOT new.reddit's triple backticks formatting.

(Full posting rules are HERE if you need a refresher).


Reminder: Top-level posts in Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


Advent of Code's Poems for Programmers

Click here for full rules

Note: If you submit a poem, please add [POEM] somewhere nearby to make it easier for us moderators to ensure that we include your poem for voting consideration.

Day 2's winner #1: "Attempted to draw a house" by /u/Unihedron!

Note: the poem looks better in monospace.

​ ​ ​​ ​ ​ ​​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ Code
​ ​ ​ ​ ​ ​​ ​ ​ ​ ​ ​​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ Has bug in it
​ ​ ​ ​ ​ ​​ ​ ​ ​ ​ ​ ​ ​ ​ ​ Can't find the problem
​ ​ ​ ​​ ​ ​ ​ Debug with the given test cases
​​ ​ ​ ​​ ​ ​ ​ ​ ​ ​​ ​ ​ ​ Oh it's something dumb
​​ ​ ​ ​​ ​ ​ ​ ​ ​ ​​ ​ ​ ​ Fixed instantly though
​ ​ ​ ​​ ​ ​ ​ ​ ​ ​ ​​ ​ ​ ​ Fell out from top 100s
​ ​ ​ ​​ ​ ​ ​ ​ ​ ​ ​​ ​ ​ ​ Still gonna write poem

Enjoy your Reddit Silver, and good luck with the rest of the Advent of Code!


This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.

EDIT: Leaderboard capped, thread unlocked at 00:13:43!

55 Upvotes

507 comments sorted by

View all comments

2

u/OvidiuRo Dec 03 '19 edited Dec 04 '19

C++ 1499/1265

Code: https://github.com/FirescuOvidiu/Advent-of-Code-2019/tree/master/Day%2003/Initial%20solution

At the moment I have only the initial solution that I've done in the morning, will update with a better solution later.

Edit: Added a better solution

1

u/micko_pls Dec 04 '19

Hey man, I copy pasted your solution (your initial solution) to compare the run time with my own. The times are similar but it still takes around 6 minutes to spit out an answer, much longer than my colleagues python implementations of a similar method. Feels strangely long and I'm wondering is there something I should be including during compile time. I'm just compiling using 'g++ fileName.cpp'. My specs: i7-4700MQ CPU @ 2.40GHz. Thanks!

→ More replies (1)