Beats me. Writeup http://www.csc.kth.se/~austrin/icpc/finals2015solutions.pdf if you want to try to figure it.