Advertisement
welleyth

3987. Complete Graph

Dec 26th, 2020
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define int long long
  6. #define mp make_pair
  7. #define pb push_back
  8.  
  9. const int N = 101;
  10.  
  11. bool bridge[N][N];
  12.  
  13. signed main() {
  14. ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
  15. //freopen("input.txt","r",stdin);
  16. //freopen("output.txt","w",stdout);
  17.  
  18. int n,m;
  19. cin >> n >> m;
  20.  
  21. int sum = 0;
  22.  
  23. for(int i=0,a,b;i<m;i++)
  24. {
  25. cin >> a >> b;
  26. sum += !bridge[a][b];
  27. bridge[a][b] = 1;
  28. bridge[b][a] = 1;
  29. }
  30.  
  31. cout << (sum == n*(n-1)/2 ? "YES" : "NO");
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement