cnt后然后cnt多的给大的权重这样
比昨天简单
昨天好难
==
def maximumImportance(self, n: int, roads: List[List[int]]) -> int:
cnt = [0 for _ in range(n)]
for road in roads:
node1, node2 = road
cnt[node1] += 1
cnt[node2] += 1
cnt.sort()
ans = 0
for i in range(n):
ans += (i+1)*cnt[i]
return ans