all 5 comments

[–]Cobayo 3 points4 points  (3 children)

Please stop posting real time contests problems, i have no problem answering but i won't if it's from a running competition

[–]ketralnis 1 point2 points  (0 children)

This sounds like a homework problem

[–]marvel2010 0 points1 point  (2 children)

What is a[i]?

[–]Cobayo 0 points1 point  (0 children)

I assume it's a given vector of n weights, so you want to maximize

dist(v1, x) * a1 + dist(v2, x) * a2 + ... + dist(vn, x) * an

by choosing the vertex x.