/aocg/ - Advent of Code 2018 General #9

T-minus Ten Minutes Edition

Previous thread: adventofcode.com/
>Advent of Code is a series of small programming puzzles for a variety of skill levels. They are self-contained and are just as appropriate for an expert who wants to stay sharp as they are for a beginner who is just learning to code. Each puzzle calls upon different skills and has two parts that build on a theme.
You need to register with an account but you can appear as anonymous.

Private leaderboard join code:

368748-e33dcae3


People who are inactive for 5 days will be kicked, but other leaderboards can be made if desired.

Alternative leaderboard for those waiting for inactives to be kicked from the first:

208834-4a1a9383

Attached: grad.png (407x446, 27K)

Other urls found in this thread:

youtube.com/watch?v=hjGZLnja1o8
youtube.com/watch?v=d5lLDqeBK1o
youtube.com/watch?v=i1Fr-SE0kNk
twitter.com/NSFWRedditImage

ITS TIME LADS

Attached: honkhonkmotherfucker.jpg (277x245, 35K)

holy shit you only just made it with 60000 ms to spare

YEAH LET'S FUCKING DO IT BOYS!!!!

Attached: 1501356406011.jpg (553x900, 260K)

NOT DPT BUT C IS THE MOST POWERFUL PROGRAMMING LANGUAGE LISPFAGS FUCK OFF

Attached: 1375579098628.gif (450x258, 2.34M)

BASED JIT THREAD

here we go

Attached: 1494840171364.png (914x898, 592K)

PYTHON BOIS, UNITE UP!

Attached: dab_on_the_sneeds.gif (1100x450, 326K)

youtube.com/watch?v=hjGZLnja1o8

Attached: australia's got talent.webm (1280x720, 1.6M)

Will today's problem be the brainlet filter?

>10 threads in 3 days
Glorious

>that fucking CG
get that shit outta here

Attached: 615269-uncle_gabby.jpg (320x276, 17K)

>hate python
>use it anyway because best option for slapping shit together

>promised myself I won't get panicky this time
>already panicking

FUCK

Attached: dabs.png (426x470, 153K)

aka everyone on the leaderboards because it's the best for throwing shit together

Fuck yeah I finished my taquitos just in tome

Fuck I need to take a shit

where are my O(n^2) lads at?

POST YOUR COMFY FACE

Attached: comfy.jpg (670x424, 145K)

Infinite matrix here we come

The guy in the lead is using ruby

waddup

T MINUS 4 MINUTES

HIT OR MISS

Attached: rem think.png (112x112, 22K)

Attached: bocchi smile hood.png (393x363, 67K)

Who knew AoC turned me into a competition-ready speed eater

Attached: 1418754418138.gif (158x158, 2.01M)

ITS TIME BOIS

SHOW ME YOUR WARFACE!

rem is a cute
i am a suicide
advent of code is hard

i hope you lads have your scratch paper ready

Attached: himiko.png (509x725, 373K)

>wc -l input.txt
>250
Fuck yeah, I will O(n^2) all day if the inputs are gonna be that small

Actually he made it with 555,000 ms to spare.

Attached: 1538946916763.jpg (1000x1230, 752K)

Damn, I won't be able to do today's in time

SHOW PREPS

Attached: Screenshot from 2018-12-03 05-56-48.png (548x395, 45K)

/ready for brainlet filter/ over here boss

Attached: 1535050408899.gif (416x416, 14K)

youtube.com/watch?v=d5lLDqeBK1o
LETS FUCKING DO THIS SHIT!!!
Ready and willing!

Attached: 1494615907561.png (500x504, 327K)

my code maaaaaaaaagic is ready UwU

I'M READY FOR THE WALL

Attached: 1538610024083.gif (500x500, 1.03M)

goodnight /aocg/. I'll join you on problem 3 sometime tomorrow

wtf it drops in two minutes, why would you go to sleep now

the perfect tune for right now

Attached: 1520402280735.jpg (604x415, 75K)

>Tfw downloaded the 500mb input file for the "bonus challenge" and still trying to figure out how to make it run efficientlyefficiently

Attention! This is Red Leader, I need all languages to report in and form up in attack formation!

Attached: star-wars4-movie-screencaps.com-13175.jpg (640x362, 46K)

Good luck, guys!

Attached: chio_gaming.png (395x355, 276K)

Attached: 1538671861161.jpg (480x480, 29K)

Last call to fire up any documentation you need for quick reference.

TMINUS 60 SECONDS, BATTLESTATIONS!

1 MINUTE BOOOIIIIIIIS

P A N I C
A
N
I
C

MATLAB ready!

wew is anyone else getting sleepy ITT? Who's John Podesta again?

who are you kidding, it's all python up in here

T MINUS 30 SECONDS

Attached: 1479270626571.jpg (600x450, 66K)

THIS IS NOT A DRILL ANONS LETS GO

Attached: 1534758533417.gif (432x324, 3.38M)

TEN!

FUCK

FUCK

FUCK

FUCK

Because I have work tomorrow and the time that the problems drop happens to be exactly the latest I can stay up without being tired the next day.

FUCK

FUCK

Oh, this gon' be bad...

>inches

FUCK

Attached: laughterstops.jpg (313x254, 56K)

Attached: 1505931274240.png (375x369, 22K)

CLAIMS CLAIMS CLAIMS

BRAINLET FILTER
BRAINLET FILTER
BRAINLET FILTER
BRAINLET FILTER

ITS THE WALL!!!

FUCKING MURRIKAN UNITS

I'm not even gonna bother trying to rush this.

FUCK

based aoc guy dropping the brainlet filter on day 3

yeah, fuck this, im going to bed and going to work, will try to do after work

Bye guys, I'm going to rest

Look out brainlet's.
THE WALL is here.
youtube.com/watch?v=i1Fr-SE0kNk

1000x1000 array coming up

TOLD YOU FUCKS THE WALL WAS ON DAY 3

>3/3
>petertseng beat me by ~10s on both parts
FUCK

IT'S A /PARSING/ EPISODE

Wait fuck I can't sleep

I NEED THE ANSWER. SOMEONE POST THE ANSWER

sleep time for me

Attached: 1472678192546.png (640x312, 248K)

I really need to lrn2regex

>Because you have guessed incorrectly 4 times on this puzzle, please wait 5 minutes before trying again.

Attached: bocchi shock.png (398x294, 72K)

Doesn't look that bad, he's a jerk for making part of the problem just parsing the input. Unnecessary.

rank 219 and 103, no points :(

I figured out how to do it, but I don't know how to parse the sting. Can somebody link me to something on how to do regular expressions in python for this case without giving me the answer?

Is Peter Tseng God's gift to programming?

this just count overlaps in an nxn array

Here user, take this

import re

def do_scrub(scrub, s):
'''Remove characters designated by `scrub` from `s`.'''
# If it starts with '[' then it's probably a regex character class.
# Otherwise, assume it's a normal list of characters.
if scrub.startswith('['):
s = re.sub(scrub, ' ', s)
else:
for c in scrub:
s = s.replace(c, ' ')
return s

def get0(scrub=None):
'''Get the entire input from stdin. Input is scrubbed using
`do_scrub(scrub, _)`.'''
s = sys.stdin.read().strip()
if scrub is not None:
s = do_scrub(scrub, s)
return s

def get1(cvt=str, scrub=None):
'''Get 1-dimensional input from stdin, one entry per line. Each line is
scrubbed, stripped, and converted using `cvt`.'''
xs = []
for line in sys.stdin:
if scrub:
line = do_scrub(scrub, line)
line = line.strip()
if line:
xs.append(cvt(line))
return xs

def get2(cvt=str, scrub=None):
'''Get 2-dimensional input from stdin. `cvt` and `scrub` work as in
`get1`.'''
xs = []
for line in get1(scrub=scrub):
xs.append([cvt(part) for part in line.split()])
return xs


Then `get2(int, '[^0-9]')` gets you the input as a list of 5-tuples of ints, so you can do `for n, x, y, w, h in claims: ...`. (Specifically, it reads each line of stdin, replaces non-numeric characters with whitespace, strips and splits the line, and converts each substring from the split to an int.)

don't over-engineer .just do it manually (i.e. use the "search and replace" of your IDE)

Not them, but I'm a fucking idiot for not doing that

that 2000x2000 array.
A=[[432,394,29,14]...]

import numpy as np
max([*map(max,A)])

M=np.zeros([2000,2000])
for x,y,dx,dy in A:
M[x:x+dx,y:y+dy]+=1

sum(sum(M>1))

for i in range(len(A)):
x,y,dx,dy=A[i]
if (M[x:x+dx,y:y+dy]==1).all():
print(i+1)

Well now I have motivation to install Pygame.
I'll see If I can't produce a graphic when this is all said and done.