LOADING: An error occurred. Update Chrome, try Firefox, or visit this post for more details.

⚠️Reddit changed how removals work, which breaks Reveddit's website. Install the extension to track removed content:Add to chromeAdd to firefoxWhat changed?
✖︎
about reveddit
⚙F.A.Q.add-ons
r/
status
copy sharelink
[+] show filters
19
SOLUTION MEGATHREAD-❄️- 2023 Day 19 Solutions -❄️-(self.adventofcode)
submitted 2 years, 1 month ago* (edited 29 minutes after) by daggerdragon to /r/adventofcode (134.8k)
465 commentsredditother-discussionssubreddit-indexmessage modsop-focus

THE USUAL REMINDERS

  • All of our rules, FAQs, resources, etc. are in our [community wiki](https:...

... view full text

since 2 years ago
1 of 1

Tip Reveddit Real-Time can notify you when your content is removed.

your account history
(check your username's removed content. why?)
Tip Check if your account has any removed comments.
view my removed comments
you are viewing a single comment's thread.
view all comments
[–][deleted]2 points2 years ago* (edited 4 minutes after)

[LANGUAGE: C++]

code

Part 1

I made a map of filters, where each filter had a name, and a vector of instructions. Each instruction was a tuple<char,char,int,string>. First char was the part value we were using. second char is the < or >. int the number we're comparing the part value to. string being what we do with the part if this instruction is true.

Then I made a queue of parts, all starting at the "in" filter. After a part runs thru a filter, accept/reject or pass to next filter, adding it back into the queue.

Part 2

Dealing with ranges now, the part queue is now a rangeQueue with one initial partRange all values set 1-4000. Use the same filters from part 1.

There's basically 3 things we need to care about when filtering a range. If the range is fully inside the filter, partially, or not at all.

If it's fully inside, we just accept/reject/pass to next filter the whole range.

If it's partially inside, we split the range at the compare value into 2 ranges. Accept/reject/pass the range that's inside the compare. Put the range that's outside the compare back into the queue with the same filter.

If the range is outside the compare completely, move onto the next instruction in the filter.

If we get to the last instruction in a filter, accept/reject/pass to next filter the range.

Upon accepting a range, we multiply the range values and add to total.

One thing I want to change is part 2 is a bit hard coded. Could be 1/4th as long.

​

Runs about 80ms for both parts on my computer.

permalinkas-of
r/revedditremoved.substack.com
🚨 NEWS 🚨
✖︎

Important: Reddit Changed How Removals Work

A recent Reddit update makes mod-removed content disappear from profile pages, which breaks Reveddit's website.

Install the browser extension to receive removal alerts.

Add to chromeAdd to firefox

What changed?

r/revedditremoved.substack.com