Proof of Stick Lengths CSES

I’ve been solving the CSES Problem Set and managed to get AC on Stick Lenghts, by simply getting the median. But I still do not understand why it works, could anyone help me by pointing out the proof?

2 Likes

Thanks! I will give it read after I get out of school. (btw I’m a huge fan of yours)