結果

問題 No.806 木を道に
ユーザー phspls
提出日時 2020-04-07 22:47:19
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 1,394 ms
コンパイル使用メモリ 168,148 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-08 07:42:35
合計ジャッジ時間 3,484 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define llong long long

int main() {
    int n;
    cin >> n;
    vector<int> lines(n);
    int result = 0;
    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        if (lines[a-1] < 2) lines[a-1] += 1;
        else result += 1;
        if (lines[b-1] < 2) lines[b-1] += 1;
        else result += 1;
    }

    cout << result << "\n";
}
0