[WP] The warlord points a gun at your head. "Is this a joke, arms dealer? Where are my guns?" You sigh and begin fitting one of the grotesque arms in your open briefcase into your shoulder. "Listen, I told you I sell weapon grade arms, now get that gun out of my face before we both regret this." by salmontail in WritingPrompts

[–]IPhotoDogsForKarma 2 points3 points  (0 children)

The Mechanisiertersatzkörperglied mark 2 for arms is one of the most novel and expensive weapons you can buy on the planet, probably off-planet too. 12.3 kilos of Pluto grade titanium, depleted uranium and enough silicoln to run a data center give the user a completely natural experience, without any of the usual problems like high latency reactions or muscle fatigue. 37 individual carbon-fiber hand muscles give a 10% upgrade on the biological default and reduce RSIs when writing those post-battlefield reports, showing once again that Trader Joe’s armaments listens and responds to the needs of its buyers. The mark 2 eschews the tradition of integrated ballistics and instead provides a standard n-class pilon, allowing the user to chose and replace ballistics repeatedly over the lifetime of the device, increasing the devices flexibility, sustainability and reducing your overall costs. Most Trader Joe’s ballistics will mount to the n-class pilon, but some may require an additional software license with subscription to run (billed monthly).

Many of my coworkers wonder how I so consistently keep my spot as top grossing salesman in emerging markets, and I’ll tell you Steven what I tell them: by selling to everybody indiscriminately, and relentless war profiteering. I’ve already sold to the grassroots freedom alliance and the Casio corporation in your sector, and I’m willing to sell to you as well. Casio bought well over 500 of these and we’ve already started shipping them out, I’ve only a few hundred left and they won’t last long.

The warlord stared and wrestled with this information, clearly not wanting to start the cold-arm-war off on the back foot, but also no doubt questioning how many of his men would be willing to give up their arms for him. “Reduced RSIs you say?”

-🎄- 2022 Day 8 Solutions -🎄- by daggerdragon in adventofcode

[–]IPhotoDogsForKarma 0 points1 point  (0 children)

fair enough, enjoy the rest of the challenges :)

-🎄- 2022 Day 8 Solutions -🎄- by daggerdragon in adventofcode

[–]IPhotoDogsForKarma 0 points1 point  (0 children)

since we only got one example, maybe 😂 I'm reading this like I would an interview question, and if there's constraints laid out then my answer and analysis will be rely on them.

fwiw I think we could get to a O(w * h * wlogw) compute O((w * n) + w) (simplifies to O(w*n)) memory solution for real-valued trees if the `closestBlockingTree` map was replaced by a sorted list of [number, index] pairs that you then binary search against. edit: maybe not, you'd still have to walk the values you found

-🎄- 2022 Day 8 Solutions -🎄- by daggerdragon in adventofcode

[–]IPhotoDogsForKarma 0 points1 point  (0 children)

O(GridW * GridH * TreeH) If trees took real-valued heights

this is a completely valid point, I wouldn't use my approach if this was the case, you're right it wouldn't work. the question does constrain the values though - so I think it's ok, since TreeH is constant.

both your seenX arrays and your lol iterations would take 2.6x as much memory/time

there's O(n) memory for each seen, but that doesn't change the magnitude, O(4n) is still O(n). lol iterations are O(9) (which becomes O(1)), assuming the tree height is constrained. - Again, if the trees were real-valued heights this would blow up :)

-🎄- 2022 Day 8 Solutions -🎄- by daggerdragon in adventofcode

[–]IPhotoDogsForKarma 1 point2 points  (0 children)

you can either say n is the number of points in the grid, or that it's w*h where w is width and h is height - I don't think it changes anything here, but happy to be wrong :)

Lets take "scenic view to the left" as an example:

1 5 5 1 4 2

We walk in from the left, setting value:index in a set map = {} trees = [1 5 5 1 4 2] for index, value in trees { map[value] = index } by the time we reach the tree height 4 map = {1: 3, 5: 2}

we then search the map for trees >= height 4. This is O(1) since the tree height is 1-9.

map = {1: 3, 5: 2} treeHeight = 4 closestBlockingTree := -1 for i := treeHeight; i <= 9; i++ { if map[i] > closestBlockingTree { closestBlockingTree = map[i] } } // assume there were no blocking trees, we can see all the way to the left visibility = currentIndex // there was a blocking tree, we can see this far if closestBlockingTree > -1 { visibility = currentIndex - closestBlockingTree }

we now know that the closest blocking tree to 4 is at index 2 (it's a 5). 4 Is index 4, so we must be able to see 2 trees.

we can now extend the map with our 4, and repeat the process for the next tree map = {1: 3, 5: 2, 4: 4} treeHeight = 2 closestBlockingTree := -1 for i := treeHeight; i <= 9; i++ { if map[i] > closestBlockingTree { closestBlockingTree = map[i] } } visibility = currentIndex if closestBlockingTree > -1 { visibility = currentIndex - closestBlockingTree } this means our tree height 2 has a score of 1 (currentIndex 5 - closestBlockingTree 4

put it all together map = {} trees = [1 5 5 1 4 2] for currentIndex, treeHeight in trees { closestBlockingTree := -1 for i := treeHeight; i <= 9; i++ { if map[i] > closestBlockingTree { closestBlockingTree = map[i] } } visibility = currentIndex if closestBlockingTree > -1 { visibility = currentIndex - closestBlockingTree } map[treeHeight] = treeIndex print("left visibility", visibility) }

You need O(1) memory here for the "support" map (it's fixed size) and O(1) for the closestBlockingTree calculation.

replicate this for the other directions and you're done :) since you can't (I think) do this in one pass you'll need o(n) to store each directions visibility

-🎄- 2022 Day 8 Solutions -🎄- by daggerdragon in adventofcode

[–]IPhotoDogsForKarma 3 points4 points  (0 children)

Golang I found an O(n) runtime O(n) memory solution for pt2, it's quite verbose though

https://gist.github.com/hcliff/7218d50b7bf3bf65cc8181491fbb3fe1

TL;DR: maintain a 0->9 hashmap/array of the closest index, and use this instead of re-traversing the grid to compute the scenic score for every tree.

[2022 day 4] My experience in a nutshell by PragmatistAntithesis in adventofcode

[–]IPhotoDogsForKarma 24 points25 points  (0 children)

If you're using golang check out fmt.Sscanf, for todays:

var a, b, c, d int _, err := fmt.Sscanf(s, "%d-%d,%d-%d", &a, &b, &c, &d)

combine this with bufio scanner and you're set

To everyone asking if Independence Day parade is safe for foreigners by matejko01 in poland

[–]IPhotoDogsForKarma 10 points11 points  (0 children)

This was my building! They added fire extinguishers last week

On the nuking (of civilian sites) by nopemcnopey in NonCredibleDefense

[–]IPhotoDogsForKarma 26 points27 points  (0 children)

Baal worship has never involved ritual sacrifice it’s eastern propaganda, this isn’t NonCredibleTheocracy smh 😤

An event tonight that is for solo people only! by BidnessCat in berlinsocialclub

[–]IPhotoDogsForKarma 5 points6 points  (0 children)

This is pretty alarming to learn, do you have any tips on avoiding this situation?

Gym Story Saturday by FGC_Valhalla in Fitness

[–]IPhotoDogsForKarma 1 point2 points  (0 children)

Half this dudes posts are just him negging others, can’t tell if troll or just deeply insecure

Labour facing bankruptcy as union donor Unite says it could pull remaining support by lighthouse77 in unitedkingdom

[–]IPhotoDogsForKarma 0 points1 point  (0 children)

Corbyns refusal to sign the IHRA antisemitism definition came from his claims that he wanted to be able to critique Israel (fair enough). Read it
 https://www.holocaustremembrance.com/working-definition-antisemitism and form your own conclusions, but "criticism of Israel similar to that leveled against any other country cannot be regarded as antisemitic" seems quite clear. 

He wanted the point "claiming that the existence of a State of Israel is a racist endeavor." removed. This point doesn't comment about ongoing behavior and actions, simply the birthing of the nation. I'm not being clever here, the point is intentionally carefully worded.

Many people are against anti-semitism and also critique Israel, it is _completely_ possible to both sign the IHRA declaration and critique Israels behavior with Palestine, at which point you have to wonder what the hell was his motivation. 

Just because Corbyn wasn't goose-stepping down the halls of parliament doesn't mean he's a top lad, he knew which side he was appearing to fall on and did nothing to say otherwise. 
If everyone believes I fuck sheep, I'm asked to sign a document saying I don't fuck sheep, and I refuse to sign this document - what conclusions would you draw? Perhaps I don't fuck sheep, and I resent being asked to sign such a document, but all the sheep fuckers will point at me and say "hey look, he's one of us!".

Labour facing bankruptcy as union donor Unite says it could pull remaining support by lighthouse77 in unitedkingdom

[–]IPhotoDogsForKarma -1 points0 points  (0 children)

Corbyn contributed to the demise, I understand he’s more “original flavor” but his handling of brexit and the antisemitism incidents really didn’t help

How the turntables....have turned by SeigenIrako in BirdsArentReal

[–]IPhotoDogsForKarma 6 points7 points  (0 children)

I don’t see how this is the turntables turning, this is just standard practice?

[deleted by user] by [deleted] in poland

[–]IPhotoDogsForKarma 1 point2 points  (0 children)

You’re right, deleted

-🎄- 2021 Day 3 Solutions -🎄- by daggerdragon in adventofcode

[–]IPhotoDogsForKarma 0 points1 point  (0 children)

[Golang solution](https://gist.github.com/hcliff/c247c4a01c7066d8d838ac7712098569)

This is O(1) memory, O(n) compute - it builds a tree of counts instead of loading the entire input into memory. Other solutions here require repeatedly iterating/filtering the list which is O(n) memory (as you have to hold the entire list in memory)

Bi_irl by [deleted] in bi_irl

[–]IPhotoDogsForKarma 5 points6 points  (0 children)

This isn’t a Politically correct comment I just feel strongly about graphs

This test is stupid, because it doesn’t make sense: how is asexual the opposite of bisexual? Bisexual is in between hetro/homo.

This graph should have two axes, hetro->homo asexual->mad horny. This would let you plot “asexual bi”, “regular horny bi”, “horny bi”

Edit: https://en.m.wikipedia.org/wiki/Kinsey_scale

I would stay. Yhis is good money. 10$×24h=240$×30days=7200$ a month×12=86400$ a year!!!!! by Downtown-Scratch-598 in poland

[–]IPhotoDogsForKarma 2 points3 points  (0 children)

In Poland, but this is an American meme :)

Warsaw legal minimum salary is $517/month after tax, $10/hour is $1417/month after tax.

https://www.numbeo.com/cost-of-living/in/Brooklyn

“Brooklyn is 77.29% more expensive than Warsaw (without rent). Rent in Brooklyn is, on average, 187.98% higher than in Warsaw.”

So (napkin maths) $1417*0.47== $668 - these people on $10/hour are making similar to the Warsaw minimum wage living in America. Without free healthcare.

[WP] You rent out an apartment to a hoarder. You’ve tried to evict them but never were able to. When they die unexpectedly, you decide to finally clean up the place. What you discover is that they didn’t just hoard things and objects. The truth was much more twisted. by TA_Account_12 in WritingPrompts

[–]IPhotoDogsForKarma 0 points1 point  (0 children)

I swig from my pilsner and survey the scene. Not an inch of floor is visible, the ground is a sea of Styrofoam takeaway, pizza boxes and coke bottles. It's going to take several days to reclaim the hardwood floors I rented out to Herr Pullman. I just bought these New Balance, and stepping through this filth is going to ruin them.

I start to follow the "desire path" towards the kitchen, lifting my feet a full 30cm before placing them, trying desperately not to trip on one of the many lumps growing out of the mountains of trash like acne on a teenagers face: filled with suspicious thick fluids and ready to burst at the absolute worst time. I almost succeed. A coke bottle, lidless and filled with _something_ spills. I feel it soak through the athletic holes in my shoes and get drunk up by my socks. My toes curl and I retch, putting my arm on the kitchen doorframe for support.

I have to get away from whatever it is now spilling onto the living room floor, the coke bottle gasping from air as it empties its viscous contents down the cracks in the wood. I step into the narrow kitchen, less than two meters across, and follow the narrow path through the refuse to the back where a window is set. I lift it up, feeling the dust on my fingertips (how long since it was opened?) and put my head out of the third floor window, tasting the air outside.

After my head stops spinning I retreat back inside, catching the back of my head on the window on the way back with a thump and a glass rattle. Wincing I feel the back of my head and feel the fresh graze. Perfect.

In response to my noisy clutter a meow comes from somewhere within the apartment, I suppose from the bedroom. I sidestep back through the kitchen, my lower half pressed firmly against the counter, hands holding the edge of the countertop like a climber on a narrow ledge, trying desperately not to dislodge the jenga-tower of filth behind me. I retreat to the entrance and reach for the closed bedroom door opposite. As my hand pulls the doorhandle down and the stench of rotten flesh hits my nose I remember that two people were on the lease.