ext/css"></style></p></div></div></div></div><div class="row"><div class="column"><h4 class="ui top attached block header">输入格式</h4><div class="ui bottom attached segment font-content"><div style="position: relative; overflow: hidden;"><div class=content><div><span style="font-size: medium">第一行两个整数N,M。</span></div>
<div><span style="font-size: medium">第二行有N个整数，其中第i个整数表示点i的权值。</span></div>
<div><span style="font-size: medium">后面N-1行每