OP didn't make a new one edition

OP didn't make a new one edition

Previous Thread Private leaderboard: 368748-e33dcae3

Zerostarlets purge has appened, there's free space.

Attached: 1543846660600.gif (1000x1000, 77K)

Other urls found in this thread:

pastebin.com/RVG3Kdzz
ptpb.pw/nwVq/c
twitter.com/SFWRedditImages

python is the most powerful programming language

Attached: 1536378767071.gif (640x360, 223K)

How long does your code take to run?

C++ is the best language and that's a FACT

O(inf) because I haven't written it yet

by powerful do you mean quickest to throw shit together? in that case, yes it's basically pseudocode

>brainlet filter
NOT WHEN I SHIFT INTO MAXIMUM OVERPAJEET

321ms

Sometimes I wonder if garbageman is a better suited job for me. There's some weird stuff going on, so I'm currently debugging my train wreck. Have a laugh: pastebin.com/RVG3Kdzz

Attached: file.png (1924x686, 363K)

real 0m0,198s
user 0m0,185s
sys 0m0,016s

$ time ./aoc03
real 0m0.023s
user 0m0.000s
sys 0m0.000s

What's your method? Collision detection and then adding the overlap area?

fizzbuzzer detected

Are people finding this hard? I admittedly have only just looked at it so part ii may be significantly more difficult, but it looks pretty straightforward.

had some trouble with part 2 because my code was pretty shit to extend past the string logic but it works fine now

...

Very trivial. It's just day 3.

It's generally pretty simple every year with the exception of 3 or 4 harder days.

OP you stupid nigger learn how Jow Forums works

i5 laptop, 89ms total.
Note that I read in the file beforehand, but parsing etc.. is done in the functions.

It's the memory expensive method, I calculate the collisions on a 2d bytearray as I read the claims in and store them in structs to have a "history" of the claims. For part 1 I just get how many numbers in this bytearray are 2 or larger, and for part 2 I retrace the claims and if all the bytes it hits are 1 then that's our guy. 3 nested for loops and I used a regex but hey it works good.

>C# and java not on same side
wherewer you pit them - they belong on same side.

Did you mean 4channel?

>No Lisp

wow you're even more retarded than the guy who posted the image, i didn't think that was possible

not enough pepes

>i accidentally posted in the previous thread.
$ time ./a.out inputs/03.txt
Part 1: 124850
Part 2: 1097
0.00user 0.00system 0:00.00elapsed 80%CPU (0avgtext+0avgdata 9232maxresident)k
0inputs+0outputs (0major+3964minor)pagefaults 0swaps

God, I love C.

top guy is using ruby
hasklel is just for meming answers on 4chinnel
tl;dr: dumb frogposter

Who cares lmao

O(n2) like the brogramming chad I am.

Wasted 20 minutes because [[0]*1000]*1000 in python doesn't actually bother creating the last 999 lines of the matrix but just creates a pointer to the first. When would you ever want it to behave like this?

Ruby has the same behaviour.

Myabe you should just understand the language lmao.

0m00.01s real 0m00.01s user 0m00.00s system
lol

mixed up my width and height in part 1 and spent a few minutes wondering why it was rejecting my answers

Attached: 1542831496180.gif (1113x1110, 141K)

C# has an interpreter built into Visual Studio :^)

The same for a lot of languages.

see

So? There is no logical reason why it should behave like this, and it gives no indication that it will behave like this until you debug it and realise that adding a value in one place also adds it in a thousand others.

around 3ms

...

>there's no logical reason as to why references should act like references

Attached: file.png (645x729, 81K)

Yeah, most everything except simple numbers is treated as a reference in python, so you have to actually think about making copies. List comprehensions are nice since they always make a new list.

You're being punished for trying to come up with """clever""" tricks without understanding the underlying functions.
The *(list, int) operator is syntactic sugar for itertools.chain(list, int)
Guess what happens when list contains a type of int? It returns that fucking int. A value type.
Guess what happens when list contains a type of list?
It returns that fucking list. A reference type.

Such argumentation skills! Such amaze. Wow.
If you have nothing to say stay silent.

7s because if the regex

Daily letter faggot here again.
This day wasn't as special in terms of language, but I think the solution turned out really beautiful and efficient.
ptpb.pw/nwVq/c

All of these rasterization solutions would fail on the blanket dimensions n being some tens of times larger than it currently is.

Sheeit how?

AOC 2018
Day 3 - Part 1 : 110383
generator: 1.2349ms,
runner: 5.8141ms

Day 3 - Part 2 : 129
generator: 1.1121ms,
runner: 5.2108ms

So about 11ms total if 1 generator call were to be used for both

real 0m0.869s
user 0m0.000s
sys 0m0.000s
The point is, it gave me the results I wanted.

Who is using OpenGL shaders ?

it's not tho so who cares, I mean look at this retard with an almost 1 second runtime top jej

Funny that you mention that. I actually started out with a slighly larger Location struct, so I encountered this problem.
To bypass it, I declared Location *blanket[HEIGHT] and then malloc()'d for each pointer.
I ended up modifying my implementation a bit so I was able to get rid of the extra int in Location, so this method worked and I went with it.

>mixed up my width and height in part 1
I did the same, how does it matter? Unless you mixed the offsets and dimensions in different ways.

nothing sophisticated

Attached: file.png (719x644, 147K)

Okay thanks lads, i'll use a double list comprehension next time

>I think I'm smart
Only a true retard optimizes something that doesn't need to be optimized at all.

thats exactly what i did, my height and width variables were named incorrectly, but my x and y ones weren't

>tfw you scale the brainlet wall

I admit at first i wanted to do it with a 3d array:
position=np.zeros([max(endpos[:, 0]), max(endpos[:, 1]), len(input)])
but it was 999x999x1305.
Final code was:
import numpy as np
import matplotlib.pyplot as plt
from numpy.core.multiarray import ndarray
import scipy.io as io

file=open(r"C:\Users\PersonalData\PycharmProjects\untitled\InputDay3.txt", "r")
lines=file.readlines()
startpos=np.zeros([len(lines), 2])
endpos=np.zeros([len(lines), 2])
cnt=0

for i in lines:
x=i.split(',')
y=x[1].split(':')
z=y[1].split('x')
x=x[0].split('@')

startpos[cnt, 0] = int(x[1])
startpos[cnt, 1] = int(y[0])
endpos[cnt, 0] = startpos[cnt, 0] + int(z[0])
endpos[cnt, 1] = startpos[cnt, 1] + int(z[1])
cnt += 1

seenpos = np.zeros([int(max(endpos[:, 0])), int(max(endpos[:, 1]))])

for i in range(len(lines)):
seenpos[int(startpos[i, 1]):int(endpos[i, 1]), int(startpos[i, 0]): int(endpos[i, 0])] += 1


print(np.count_nonzero(seenpos>1))
#plt.imshow(seenpos, cmap='hot', interpolation='nearest')
#plt.show()


overlap=np.zeros([int(max(endpos[:, 0])), int(max(endpos[:, 1]))])
for i in range(len(lines)):
newpos = np.zeros([int(max(endpos[:, 0])), int(max(endpos[:, 1]))])
newpos[int(startpos[i, 1]):int(endpos[i, 1]), int(startpos[i, 0]): int(endpos[i, 0])] += 1
overlap=np.logical_and(newpos == 1, seenpos > 1)
if True not in overlap:
print (i+1)

still brainlety, but at least i made it past the (first) wall

Attached: Heatmap.png (640x480, 21K)

Hello, I am attempting advent of code in Java. I want to be able to show off my progress using a Github repository, but I'm not exactly sure how it should be set up. Can someone guide me on how to do it? Or explain how you set up your's if you are using Github? Any help would be greatly appreciated.

>made it past the (first) wall
reminder that this was not a brainlet filter.

kindfuly make a repository,,,, sirr

please do the rtfm sir

I've got an idea for part 1, but I'm not sure how counting the square footage would work when there'll be multiple overlapping sections.

You had nothing useful either to say either, shut the fuck up retard.

1. create a github account
2. install git in your machine
3. create repository on github
4. go into your project folder
5. add the repository to git using "git remote add origin [your_repository_url]"
6. when you are done with whatever you are doing add the changes to git using "git add .", place whatever files you don't want to be added to the repository in your .gitignore file beforehand
7. commit your changes using 'git commit -m "[your commit message]"'
8. push your changes to git using "git push origin master"

... or just look up a 30 minute git tutorial so you know how to use it

from collections import defaultdict

def main():
with open("input.txt") as f:
content = f.read().replace(' ','').splitlines()

parsed, coords_checked = [], defaultdict(dict)

for line in content:
pos_x = int(line[line.index('@')+1:line.index(',')])
pos_y = int(line[line.index(',')+1:line.index(':')])

width = int(line[line.index(':')+1:line.index('x')])
height = int(line[line.index('x')+1:])

parsed.append([pos_x, pos_y, width, height])

for line in parsed:
for x in range(line[0], line[0] + line[2]):
for y in range(line[1], line[1] + line[3]):
try:
if coords_checked[x][y] >= 1:
coords_checked[x][y] += 1
except:
coords_checked[x][y] = 1

for claim_id, line in enumerate(parsed):
overlap = False
for x in range(line[0], line[0] + line[2]):
for y in range(line[1], line[1] + line[3]):
if coords_checked[x][y] > 1:
overlap = True
if overlap:
continue
else:
print(claim_id + 1)
break


who else here /BROGRAMMER/

Attached: 1513395187926.png (498x467, 16K)

The fucking scoring is so shit
I was only able to start this shit today like 4 hours ago
Already finished days 1 to 3 but because I had to start today my rank is garbage

I'm not waking up at 5am to start a fucking coding challenge fuck you

don't worry user you wouldn't win anyway unless you were using python or similar languages that abstract away all the challenging parts

just join the 4dayslate-gang leaderboard

I'm doing it a step worse
Javascript
I was too lazy to ingest the data properly so I just open the console and do
let data = document.body.textContent.split('\n').map(...)
And then I just finish it in the browser

Attached: image0.png (462x610, 238K)

You not showing the kind of dedication we expect from our programmers.

Attached: 1520090197979.jpg (630x420, 65K)

I'm too dumb for this shit. Wasn't even able to identify if two rectangles overlap.

Attached: 1507714976056.png (691x653, 84K)

lol i love how butthurt languagelets are

For certain use cases, this is all you need. Certain weird task that has to run once every 2nd Wednesday at 8:47pm? Sure. Small job to sort purchases by most appealing to furries? Great!

>provides no counterargument
very nyaice

this is correct.

Attached: 1531484628153.png (600x550, 307K)

White = fabric
Red = overlap
Green = solution
/

Attached: day3.png (1000x1000, 12K)

Attached: 1481352717880.jpg (300x375, 33K)

I'm proud of you user. That's the way to do it. Quick and inventive, because all that matters are the results. Let the C and Haskell fags trip over each other with their huge sources and empty pride. They're a dying breed and rightfully so.

Attached: 1528206541354.jpg (1136x852, 108K)

For this, you don't need to do that.
You can have a 1000^2 field of zeroes, and with every rectangle increment the cells it covers. Then just loop over it and count all ones.
The second part could use AABB collision detection but I just went over the modified canvas to find the one claimed area that still had only ones in it.

Generating the input is more impressive than our solutions

>brainlets using complicated parsing instead of re.findall('[\d]+', claim)

Attached: camel2.jpg (422x367, 34K)

Really nice, it should be in the calendar.

>he who has no friends will be picked
I'm sure Jow Forums will find this encouraging.

Attached: 1522603194731.gif (352x224, 866K)

>people using fast parsing hur

Yes, that seems interesting. I'm going to give it a go.

>optimizes
You're saying that optimizing is making it faster. That's wrong. In this case, optimizing would be extending it to be more functional, which is not needed. Making it how it was is simpler.

>look mom I solved this O(1) problem in 1ms instead of 2

let parse line =
let ib = Scanf.Scanning.from_string line in
Scanf.bscanf
ib "#%d @ %d,%d: %dx%d"
(fun id left top width height ->
{
id = id;
left = left;
top = top;
width = width;
height = height;
})
;;

>O(1) problem
i had a feeling you were a brainlet.

Attached: hideri_smug.png (983x983, 523K)

It's literally O(1). Prove the opposite. You cannot (because it's O(1)).

Boom roasted

>parsing
>O(1)
String parsing is faster (and safer) when you don't use a regular expression

Attached: 1535334301987.gif (733x650, 478K)

Are you claiming that it's O(1) because the input is fixed and therefore "a constant"?

wait, u sayin for any input of length n you can solve it in O(n)?

this I don't think you understand Big-O notation, user.

it's perfect

Attached: p.jpg (1600x1200, 382K)

How is it safer.
>