結果
| 問題 | No.806 木を道に |
| コンテスト | |
| ユーザー |
neko_the_shadow
|
| 提出日時 | 2019-03-22 21:54:27 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 36 ms / 2,000 ms |
| コード長 | 395 bytes |
| 記録 | |
| コンパイル時間 | 469 ms |
| コンパイル使用メモリ | 93,164 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-07 08:42:30 |
| 合計ジャッジ時間 | 2,070 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
int main() {
int n;
std::cin >> n;
std::vector<int> c(n, 0);
for (int i = 0; i < n - 1; i++) {
int a, b;
std::cin >> a >> b;
a--;
b--;
c[a]++;
c[b]++;
}
int x = std::count_if(c.begin(), c.end(), [&](int v){ return v == 1; });
std::cout << x - 2 << std::endl;
}
neko_the_shadow