Temporarily, Codeforces is operating in a limited mode due to technical reasons (historical data is unavailable). This will be fixed in the next few hours. ×

Comments

oh, i was thinking f(x,y) as shortest distance btw x,y

In E, we can find lengths using dijikstra but how would we pair A,B??. One way can be sorting lengths of each pair (Ai,Bi), but that would be k^2.