0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00

B - Star or Not

https://atcoder.jp/contests/abc225/submissions/26898727
This commit is contained in:
Baoshuo Ren 2021-10-30 20:12:18 +08:00 committed by Baoshuo Ren
parent 2250e77034
commit 7896bca156
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

23
AtCoder/ABC225/B/B.cpp Normal file
View File

@ -0,0 +1,23 @@
#include <bits/stdc++.h>
using namespace std;
int n, a, b;
vector<int> g[100005];
int main() {
cin >> n;
for (int i = 1; i < n; i++) {
cin >> a >> b;
g[a].push_back(b);
g[b].push_back(a);
}
for (int i = 1; i <= n; i++) {
if (g[i].size() == n - 1) {
cout << "Yes" << endl;
exit(0);
}
}
cout << "No" << endl;
return 0;
}