swlabr

joined 2 years ago
[–] [email protected] 6 points 1 month ago* (last edited 1 month ago)

Menawhile: tenga stock prices soar because apparently their toys are so good that a guy was willing to kill for them to be banned

[–] [email protected] 6 points 1 month ago (2 children)

OwO what’s this?

[–] [email protected] 6 points 1 month ago

NB: I will not perform sleuthing, i.e. reading up on this guy or anything he wrote. I don't think it's worth it

[–] [email protected] 7 points 1 month ago (4 children)

Is it crazy that I don't think that the guy is the shooter? I don't see the EA crowd, famous for bootlicking, being up to the task of CEO assassination.

[–] [email protected] 2 points 1 month ago (1 children)

"sounds good to me"!

[–] [email protected] 3 points 1 month ago (3 children)

Day 10. I lied about doing this later, I guess.

p1, 2 I accidentally solved 2. before 1.My initial code was: for every 9, mark that square with a score of 1. Then: for (I = 8, then 7 ... 0) => mark the square with the sum of the scores of the squares around it with a value of i + 1.

Except that gives you all the ways to reach 9s from a 0, which is part 2. For part 1, I changed the scores to be sets of reachable 9s, and the score of a square was the size of the set at that position.

[–] [email protected] 1 points 1 month ago (3 children)
[–] [email protected] 2 points 1 month ago

I will probably slow down and try to solve the problems on the weekends rather than daily. Anyway, 9:

part 1This was straightforward in that all you need to do is implement the algorithm as given. I did optimise a little using the arithmetic progression sum, but this is a speed-up of, at most like, a factor of 9.

I am pretty sure I did an OK job at avoiding edge cases, though I suspect this problem has many of them.

part 2Again, the algorithm is more or less given: Start from the back, look for a hole that'll work, and put it in if you can. Otherwise, don't. Then, calculate the contribution to the checksum.

The complex part was the "look for a hole" part. My input size was 19999, meaning an O(n^2^) solution was probably fast enough, but I decided to optimise and use a min heap for each space size prematurely. I foresaw that you need to split up a space if it is oversized for a particular piece of data, i.e. pop the slot from the heap, reduce the size of the slot, and put it in the heap corresponding to the new size.

[–] [email protected] 3 points 1 month ago (2 children)

d8: done, and nothing to say about it.

[–] [email protected] 5 points 1 month ago

As a human,

[–] [email protected] 2 points 1 month ago

We love to see it

view more: ‹ prev next ›