You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
654 B
C++
24 lines
654 B
C++
#define _CRT_SECURE_NO_WARNINGS
|
|
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
int a[300020][2];
|
|
multiset<int> S;
|
|
int main()
|
|
{
|
|
int n, m;
|
|
scanf("%d%d", &n, &m);
|
|
for (int i = 0, x, y; i < m; i++)
|
|
scanf("%d%d", &a[i][0], &a[i][1]);
|
|
for (int i = 0; i < m; i++)
|
|
S.insert(a[i][0]), S.insert(a[i][1]);
|
|
for (int i = 1; i <= n; i++)
|
|
if (S.count(i) == 0)
|
|
return puts("No"), 0;
|
|
for (int i = 0; i < m; i++)
|
|
if (S.count(a[i][0]) > 1 && S.count(a[i][1]) > 1)
|
|
return puts("No"), 0;
|
|
puts("Yes");
|
|
return 0;
|
|
}
|