Editorial for LCC '24 Contest 2 S3 - Partners


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: JojoTheWarrior

For every a_i, there's another a_j such that a_i + a_j = X, where X is the sum of each pair.

If you add every a_i together, you'll end up adding N pairs of X, so the sum is NX. Since we know N, we can just divide this sum by N to find X. Then, it remains to subtract a_i from X to find your partner.


Comments

There are no comments at the moment.