Sekoia

joined 1 year ago
[–] [email protected] 2 points 1 week ago

Ah, my bad then.

[–] [email protected] 1 points 1 week ago (1 children)

... what you said is correct, but that's superposition, not entanglement. Entanglement is when you create a product state of several qubits that cannot be decomposed into a tensor product of basic states (a single proton/photon/whatever).

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

Oh yeah, that. My bad, mixed 'em up.

The original algorithm doesn't use entanglement, though! Just the fact that measurements can change the state. You can pick an axis to measure a quantum state in. If you pick two axes that are diagonal to each other, measuring a state in the "wrong" axis can give a random result (the first time), whereas the "right" one always gives the original data.

So the trick is to have the sender encode their bits into a randomly-picked axis per bit (the quantum states), send the states over, and then the receiver decodes them along a random axis as well. On average, half the axes will match up and those bits will correspond. The other bits are junk (random). They then tell each other the random axes they picked, which identifies the right bits!

They can compare a certain amount of their "correct" bits: if there's an eavesdropper, they must have measured in the wrong state half the time (on average). Measurement changes the state into its own axis, so the receiver gets a random bit instead of the right one half the time. 25% of the time, the bits mismatch, when they should always correspond.

[–] [email protected] 1 points 1 week ago (9 children)

You can have post-quantum cryptography using classical computation, though

("Simply" pick a problem with no quantum acceleration. I think Elliptic Curves Cryptography works, but I'm not an expert)

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

Neat! I can't wait for Cosmic, it's shaping up to be so nice

[–] [email protected] 0 points 3 weeks ago (3 children)

Very nice! Does/will cosmic have the ability to style buttons? Those are the main factorio UI feature imo (that and so many slots, which aren't a normal UI element)

[–] [email protected] 42 points 1 month ago* (last edited 1 month ago) (1 children)

"The transgender topic" is already weird as a statement (kinda like "the gay agenda", it comes off as only considering it as a political statement?), and "clearly promoted by the bourgeoisie" implies it's bad.

"Gas far as [...] lgbt flags on government buildings": it's... not far at all? Again, weird statement.

"Biological male" is both wrong for the boxer (she's cis) and generally used for transphobia (trans women on HRT aren't biological males by any reasonable definition). It's also generally conspiratorial.

Overall it's not explicitly transphobic or bad to me, but it shows at minimum a very misinformed perspective.

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

Why the fuck are legal databases locked behind paywalls

[–] [email protected] 3 points 1 month ago* (last edited 1 month ago)

Here's an archived version of that medium link that doesn't cut off: https://archive.is/FNqUx (and that loads super fast)

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

Yeah that's fair. I don't quite know why I read that the way I did, but I read the "choosing" as "lives there and isn't actively attempting to move".

[–] [email protected] 6 points 2 months ago

And therefore you are

[–] [email protected] 21 points 2 months ago (3 children)

.... do you just expect everybody who lives there to pack up and leave? Even though their entire lives might be there and moving costs a ton?

 

Spoilers and explanation of solution:

Each vertex here is one intersection in our hike. We don't actually care about the parts in-between, because there's only one way to go. The above is a visualisation of the final path, the red edges are the edges taken. Our graph looks "like that" because it's a hiking trail, not a maze, so there's no dead ends. This took about 2 seconds to generate, due to all the cloning needed to keep track of paths. The two veeery long edges on the ends are pretty obvious choices, but one might notice that pretty much every vertex takes the two maximum paths it has, given the restrictions of the path. There's still some mildly surprising paths, such as (99, 29) -> (89, 37) with a weight of 38. I'm wondering if there's a way to dismiss more paths... This graph is actually pretty free in terms of movement.

My actual solution takes ~150 ms to run (and 8 microseconds for part one with barely any optimization, damnn)

 

Anybody got some ideas to optimize today? I've got it down to 65ms (total) on my desktop, using A* with a visitation map. Each cell in the visitation map contains (in part 2) 16 entries; 4 per direction of movement, 1 for each level of straightaway. In part 2, I use a map with 11 entries per direction.

Optimizations I've implemented:

  • use a 2D array instead of a hashset/map. No idea how much this saves, I did it in the first place.
  • the minimum distance for a specific cell's direction + combo applies for higher combo levels as well for part 1. For part 2, if the current combo is greater than 4, we do the same*. Gains about 70(!!) ms
  • A* heuristic weighting optimization, a weight of about 1% with a manhattan distance heuristic seems to gain about 15 ms (might be my input only tho)

*Correctness-wise: the reason we're splitting by direction is because there's a difference between being at a cell going up with a 3 combo but a really short path, and going right with a 0 combo but a long path. However, this is fine because a 3 combo in the same direction as a 0 combo is identical, just more restrictive.

Optimizations that could be done but I need to ensure correctness:

the same optimization for the combo, but for directions. If I'm on a specific combo+direction, does that imply something about the distance for another direction? Simply doing the same for every non-opposite direction isn't correct

Code: https://codeberg.org/Sekoia/adventofcode/src/branch/main/src/y2023/day17.rs

Warning: quite ugly, there's like 8 copy-pastes for adding to the queue

 
view more: next ›