Editorial for PIB '20 P5 - 4D Matrices


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: Plasmatic

Let m be the median of array k if we set v to all 0.

Observe that if we shift every element of a by -m, the median of array k is now 0.

To shift the elements of a by -m, simply assign -m to all elements in v.

Time Complexity: \mathcal{O}(N^2 \log N)


Comments

There are no comments at the moment.