摘要:
There are N flowers arranged in a row. For each i (1≤i≤N), the height and the beauty of the i-th flower from the left is hihi and aiai, respectively. 阅读全文
摘要:
Print the answer. Sample Input 1 3 2 8 4 Sample Output 1 56 We have ∑Ni=2∑i−1j=1(Ai−Aj)^2=(8−2)^2+(4−2)^2+(4−8)^2=56. Sample Input 2 5 -5 8 9 -4 -3 Sa 阅读全文
摘要:
There is a tree with NN vertices, numbered 1,2,…,N1,2,…,N. For each ii (1≤i≤N−11≤i≤N−1), the ii-th edge connects Vertex xixi and yiyi. Taro has decide 阅读全文