結果

問題 No.806 木を道に
ユーザー onsen_manjuuuonsen_manjuuu
提出日時 2020-08-29 03:07:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 285 bytes
コンパイル時間 1,682 ms
コンパイル使用メモリ 163,616 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-26 15:53:42
合計ジャッジ時間 3,299 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 WA -
testcase_03 AC 1 ms
6,944 KB
testcase_04 WA -
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 13 ms
6,944 KB
testcase_11 AC 13 ms
6,944 KB
testcase_12 AC 49 ms
6,944 KB
testcase_13 AC 37 ms
6,940 KB
testcase_14 AC 46 ms
6,944 KB
testcase_15 WA -
testcase_16 AC 19 ms
6,940 KB
testcase_17 AC 43 ms
6,944 KB
testcase_18 AC 6 ms
6,940 KB
testcase_19 AC 14 ms
6,944 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 59 ms
6,944 KB
testcase_24 AC 32 ms
6,940 KB
testcase_25 AC 45 ms
6,940 KB
testcase_26 AC 17 ms
6,940 KB
testcase_27 AC 58 ms
6,944 KB
testcase_28 AC 3 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll = long long;

int main()
{
	int n;
	cin >> n;
	vector<int> dig(n);
	for(int i = 0; i < n - 1; i++) {
		int a, b; cin >> a >> b;
		dig[a]++;dig[b]++;
	}
	int cnt = 0;
	for(auto i : dig)cnt += max(0, i - 2);
	cout << cnt << endl;
}
0