結果

問題 No.2427 Tree Distance Two
ユーザー 👑 hitonanodehitonanode
提出日時 2023-08-18 23:21:31
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 989 ms
コンパイル使用メモリ 90,792 KB
実行使用メモリ 7,936 KB
最終ジャッジ日時 2024-05-06 06:03:14
合計ジャッジ時間 5,223 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 90 ms
7,808 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 88 ms
7,936 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 92 ms
7,936 KB
testcase_08 AC 93 ms
7,936 KB
testcase_09 AC 92 ms
7,936 KB
testcase_10 AC 90 ms
7,808 KB
testcase_11 AC 91 ms
7,936 KB
testcase_12 AC 93 ms
7,936 KB
testcase_13 AC 93 ms
7,936 KB
testcase_14 AC 76 ms
7,856 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 4 ms
5,376 KB
testcase_21 AC 4 ms
5,376 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 4 ms
5,376 KB
testcase_25 AC 22 ms
5,376 KB
testcase_26 AC 53 ms
6,144 KB
testcase_27 AC 36 ms
5,376 KB
testcase_28 AC 82 ms
7,552 KB
testcase_29 AC 72 ms
7,040 KB
testcase_30 AC 52 ms
6,016 KB
testcase_31 AC 33 ms
5,376 KB
testcase_32 AC 51 ms
6,016 KB
testcase_33 AC 44 ms
5,760 KB
testcase_34 AC 14 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <utility>
#include <vector>
using namespace std;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    int N;
    cin >> N;
    vector<pair<int, int>> edges(N - 1);
    vector<int> deg(N);
    for (auto &[a, b] : edges) cin >> a >> b, --a, --b, deg.at(a)++, deg.at(b)++;
    auto deg2 = deg;
    for (auto [a, b] : edges) deg2.at(a) -= deg.at(b), deg2.at(b) -= deg.at(a);

    for (auto d : deg2) cout << -d << '\n';
}
0