保存されている過去のバージョンの一覧

2021年01月02日16時12分06秒

Codeforces Good Bye 2020 D問題 - 13th Labour of Heracles

Source

Codeforces Good Bye 2020 D問題 (1000pt)
Problem description

問題概要

省略

解法

省略

cLayversion 20201229-1)のコード

C++に変換後のコードはこちら

//no-unlocked
int N, A[1d5], B[1d5]; ll W[1d5];
int deg[1d5];
ll res[1d5];
{
  REP(rd_int()){
    int i, k;
    rd(N,W(N),(A--,B--)(N-1));
    rep(i,N) deg[i] = -1;
    rep(i,N-1) deg[A[i]]++, deg[B[i]]++;
    res[0] = sum(W(N));
    rsortA(N, W, deg);
    k = 0;
    rep(i,N) rep(deg[i]) res[k+1] = res[k] + W[i], k++;
    wt(res(N-1));
  }
}

Current time: 2024年04月19日12時32分50秒
Last modified: 2021年01月02日16時12分06秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces Codeforces_Good_Bye_2020
トップページに戻る

Logged in as: unknown user (not login)

ログイン: