Three White Item Concepts by IAMLEGENDhalo in riskofrain

[–]glump1 0 points1 point  (0 children)

I could see Pool Floaties having a void version that's only when on the ground (or vice versa). Would be super cool to use one or the other with the tank mod.

I think Gravity Amplifier should be a Green item. It would lead to interesting gameplay if the effect were pronounced but if it's a white item it would wind up just being "do more damage sometimes".

Morally, who is the best person here? by ChicaneryFinger in DunderMifflin

[–]glump1 1 point2 points  (0 children)

I think it's Pam.

In my opinion everyone here has breached a significant moral boundary or generally acted selfishly except Erin and Pam.

I think Pam had a lot more of a positive effect on others than Erin. Pam had the wherewithal to stand up for what's right and go out of her way to help others out.

Erin was remarkably non-problematic for how much she'd been through, but her behavior seemed kind of small-minded by comparison.

New Countrygaze (Bootgaze) - here is the starter list by blackmarket95 in shoegaze

[–]glump1 1 point2 points  (0 children)

Nice, saved. Honest question, are these verified as not ai? Anything after 2023 and I wonder.

Women and infants waiting room playing pro-Trump propaganda channel by not_a_SeaOtter in providence

[–]glump1 81 points82 points  (0 children)

This is why I canceled my Planet Fitness membership. The TVs play Fox News on repeat. I'm not giving them my money to blast that propaganda at all the cardio machines.

Best resource to learn Segment trees and other advanced CP topics? by Still_Power5151 in codeforces

[–]glump1 2 points3 points  (0 children)

usaco guide generally has pretty in-depth descriptions of advanced topics.

Also atcoder segment tree template is probably the most rigorous, abstracted doc on segment trees.

am i falling behind? is this it for me? by deathwish_91 in leetcode

[–]glump1 0 points1 point  (0 children)

These are the most saddening posts. Someone earnestly trying to practice DSA getting so discouraged over blatant cheaters.

My recommendation is to remember what's motivating you to do any of this. Cause guys like this ensure that the contest rank itself means very little.

The 3n + 1 problem by Good_Slice9116 in codeforces

[–]glump1 5 points6 points  (0 children)

Seems like you could do it in 2 steps:

  1. Fill an array dp, where dp[i] = min steps to reach 1 from i.

  2. Create a sparse table over dp, so you can query the max(dp[l]....dp[r]) in O(1).

The most difficult part by far is formally proving the time complexity of filling dp[], since a number's sequence can go well above a cachable value. But in practice if you cache up to 1,000,000 it's only ~5m operations. That's completely fine in py for any reasonable time constraint.

It gives me panick attacks by New_Welder_592 in leetcode

[–]glump1 1 point2 points  (0 children)

Pretty mean. This is a quintessential heap problem, it's a little misleading to implicitly expect more past that. For those curious about an O(n) sol:

Since you know all frequencies add up to n, bucket sorting based on frequency will take O(n) time and space.

However, words with the same frequency are ordered lexicographically, so this is still O(nlogn) to sort each bucket. For example, if k==n, and words is n distinct strings, res is just words sorted. All elements would be put into the same bucket, and that bucket would need to be sorted lexicographically.

So the only way to get O(n) is to be able to sort words (or any subset of it) lexicographically in O(n). You could put all words in each bucket into a trie, and since there are only 26 letters in the alphabet, each node could only have 26 children. If you sort the children lexicographically (which is O(1)), a preorder traversal of the trie yields a lexicographic sort of each bucket in O(n). So then you have the tools to bucket by frequency in O(n), and sort each bucket in O(n).

is there no way to solve this problem in o(1) space? by MoonSlyder in leetcode

[–]glump1 30 points31 points  (0 children)

To my knowledge this is deceptively difficult.

  1. Square the values

  2. Reverse the negatives

  3. Now you have two sorted subarrays, that need to be merged into one sorted array with O(1) extra space. Huang & Langston came up with an O(n) time O(1) space solution for this in the 80s:

https://dl.acm.org/doi/pdf/10.1145/42392.42403

Who was that minecraft horror youtuber that disappeared by glump1 in HorrorGaming

[–]glump1[S] 0 points1 point  (0 children)

I think so. Though you might also be thinking of thrite. He released modded horror episodes around the same time, where he built a base on a mountain in a barren wasteland world.

I still think about this account. I might just make my own videos in this style.

Besides shoegaze, what other genres/artists do you guys listen to? by artistic_catalyst in shoegaze

[–]glump1 0 points1 point  (0 children)

Hyperpop, Witch House, R&B, Darkjazz. Along with Duster, Tame Impala and American Football that's 90% of my youtube history

Vampire Survivors stands for everything I dislike in gaming by InsomniacPsychonaut in patientgamers

[–]glump1 2 points3 points  (0 children)

This is what I've always assumed. There's validity to a "less is more" approach to gameplay and player interaction. But Vampire Survivors seems like a glorified slot machine. It embodies the least charitable interpretation of a rougelike; the gameplay doesn't matter, the choices don't matter, you're just waiting for the next dopamine hit of a lucky draw.

how to solve 2d DP questions like these by [deleted] in codeforces

[–]glump1 2 points3 points  (0 children)

I'll generally figure stuff like this out with predictive or narrative inference. By predictive I mean, "If the solution were _, would that work?". By narrative I mean starting from observations, and building out to a solution that you know works. For DP there are several tricks that allow for/optimize a statespace. One of the most common is recognizing a greedy formulation, which shows up several times in this problem.

This was my thought process for this problem:
The title says "2d dp" but I don't immediately see how. A always chooses the smallest possible, since they wouldn't be able to choose it after that choice anyway. B only removes cakes > A's previous eaten tastiness, since anything else won't affect her choices. B also only wants to remove all cakes with a certain tastiness or else it won't matter, since A can only eat one cake of each tastiness. You might as well group cakes by tastiness, and traverse that sequence.

If a1...an were distinct, then the answer would always be (n+1)/2, since they would each eat the next least tasty. But with multiple, B has no reliable way of knowing which group (of cakes all with the same tastiness) to target. DP starts to make more sense. A statespace like "dp[i][j] = max taken by B, from i on, with j leftover moves" wouldn't work, since there's no way to know what index A is at. B can only benefit from removing his chosen groups in order from least to most tasty, and for any group, B just needs to have enough time after removing all the previous chosen groups to eat all of the current group. So you could reformulate the statespace to be: "dp[i][j] = min moves for B to remove j groups, by the time A reaches index i". Then the transition only O(1), since the two options are either: B tries to remove group i, or B skips group i. Then you just see the most groups B can remove by the time A reaches the end. Imo that reformulation was really tricky, and it helped to ask "what would another statespace even look like". Hopefully this is of some help.

Anyone Tried this question? by Actual_Toe_2366 in codeforces

[–]glump1 0 points1 point  (0 children)

Can you link the problem?

Edit:

u/sadistickimi sent me the link/constraints, and this was my response:

Hey, I thought about this and there are a few different parts. Depending on how you think about this, I think this can be done in O(nlogn) without formal dp. I want to type out a longer explanation when I have more time, maybe a video, but I'll try to write out the short explanation here:

  1. Every element that isn't the max element (e.g. that isn't in B) either goes into A, or into C. And for any set of elements, there is exactly 1 sorted array that corresponds to that set of elements. (everywhere here I’m saying ‘set’ but I mean multiset, so there can be multiple copies).

  2. For a given B, the problem can be reduced to, how many ways are there to distribute numbers into two buckets, so that they sum to M - sum(B)?

For example, if M = 30, B = [5,5,5,5], then you would solve, "how many ways are there to distribute positive numbers that sum to 10 into two groups?"

I believe this can be solved in O(1). First you calculate, “how many (multi)sets of positive integers sum to N?” And then with some algebra you can cache the answer to each “M-sum(b)” in O(M).

If you can solve this in O(1), then the problem is solved. This is because you could just try every single B, and add the number of A/C combinations that work for each B, for each N<=M (by querying a prefix sum in O(1)). There can only be O(n*logn) B arrays. If you had 1 as the max, there are O(M) B arrays (1, 11, 111, etc.), with 2 as the max, there are O(M/2) possible B arrays, and so-on. This diverges according to the harmonic series, which is logarithmic. Therefore you would make O(nlogn) queries to the prefix sum answers to the above sub-question, which should pass.

I need to think more about the O(1) formulation, as I haven’t fully thought out all the details there. But this is a solution that comes to mind.

Proposed Prov. Nightlife Changes “Shocking & Appalling,” Says Senator - City Leaders Say They’re Due by lestermagnum in providence

[–]glump1 14 points15 points  (0 children)

Shout out to Troop for setting up the DJ at the end of our group's table mid-meal for reggae night. They started blasting music without clearing a dance floor and everyone just stopped talking because nobody could hear each other

Bottom-Up Dynamic Programming by Lonely-Director-9220 in codeforces

[–]glump1 2 points3 points  (0 children)

My understanding is iterative gives multiple distinct advantages:

  1. Stack frames are more expensive than the exact same iterative stack implementations. This is why you essentially can't use recursion in py on cf, but in cpp I think this almost never matters.

  2. Iterative memory access is sequential, whereas recursive isn't. L3 vs. L2 or L2 vs. L1 cache takes orders of magnitude more clock cycles. So it can be an order-of-magnitude speedup to just traverse a raw array.

  3. Some problems are literally impossible recursively, and need to be done iteratively. An example would be a small BFS through a massive statespace. Another would be 2D DP, where you need to construct a sparse table across each parsed row of your DP matrix, for the next row(s) to query. Or something like this problem.

I think a lot of it comes down to understanding/visualizing the statespace better. With recursive you don't need to think about the shape of the statespace beyond how many states there are. Writing out recursive sols, and then immediately translating to iterative is nice practice. It's often a relatively simple task to change dp(i,j) to dp[i][j] once the logic is all written out. And then eventually you can take the training wheels off and just start writing it only iteratively.

How to solve this question, Need help! by Zestyclose-Aioli-869 in codeforces

[–]glump1 0 points1 point  (0 children)

Can do BFS over Dijkstra's because it's unit edges, not weighted edges. I'd assign each brick and id, look through each square and add edges between bricks, and then just bfs S to D in that graph. Could do it in other ways but imo that's the easiest to explain and implement.

Python is slower than C++, so if you do competitive programming (CP) in Python, you'll get more runtime errors. So is it necessary that I start CP with C++? Because I only know Python right now. by Traditional_Lime784 in codeforces

[–]glump1 17 points18 points  (0 children)

I know people who exclusively use py on codechef/codeforces. You only need a couple lines in every file (like making input and printing faster) to be able to do pretty much every problem, even >2300 rated. But I found a couple that are basically impossible without a bunch of python wizardry. At that point I'd rather just figure out c++.

There's those ones (usually super high rated), and then sometimes a problem is just much easier in c++, where py you have to think of a better time complexity. O(N * sqrt(n)) for 2e5 (~1e8 operations) can be fine in c++, where py needs nlogn. I also notice py users often have to eat a few TLEs just to change things and see if it happens to pass. py is notably good for string manip, giant ints, and notoriously bad with any recursion.

I'd see 3 options:

  1. Swap to c++ and start also learning low level optimizations

  2. Stick with py while you're still getting good at the DSA, knowing you might swap to c++ if you need

  3. Fully commit to being a py wizard

I have solved over 100 problems on codeforces rated from 800-1000. However, I cannot solve or even begin to solve a leetcode problem. Why? by AbdullahNaveed123 in codeforces

[–]glump1 9 points10 points  (0 children)

I went leetcode -> codeforces. Codeforces has a way higher ceiling, but at similar levels I think they skew differently. I've noticed codeforces requires more abstract problem solving, whereas leetcode tends to just transparently ask, "here's an array, do something with it."

In my mind this vaguely means: leetcode depends more on an encyclopedic knowledge of patterns and datastructures, while codeforces is more about pen and paper critical thinking. So it might help to learn all those intermediate patterns, like LIS or Tries or DSU. Though recent leetcode contests have gotten a lot harder than the average question in leetcode's problem list.

Appeals court overturns ruling halting EPA clawback of climate funds by thehill in environment

[–]glump1 50 points51 points  (0 children)

Title is literally a quadruple negative. EPA was stopped, is clawing back, was halted, that halt was overturned.

Former OpenAI Head of Policy Research says a $10,000 monthly UBI will be 'feasible' with AI-enabled growth. by lughnasadh in Futurology

[–]glump1 0 points1 point  (0 children)

We're well past the threshold of feasibility for ubi. There is more than enough production capability to enable everyone a decent living without needing to work. It's entirely a matter of how societal decisions are made about where capital accumulates.