Source code for submission s727

fn.cpp

  1. #include <cstdio>
  2. using namespace std;
  3.  
  4. int graf[10005];
  5. int N, M;
  6.  
  7. int main()
  8. {
  9. int a, b;
  10. bool lze;
  11. while(scanf("%d", &N) != EOF)
  12. {
  13. for(int i=1; i<=N; i++)
  14. {
  15. graf[i] = 0;
  16. }
  17. scanf("%d", &M);
  18. lze = false;
  19. for(int i=0; i<M; i++)
  20. {
  21. scanf("%d %d", &a, &b);
  22. graf[a]++;
  23. graf[b]++;
  24. if(graf[a] >= 4 || graf[b] >= 4)
  25. lze = true;
  26. }
  27. if(lze)
  28. printf("YES\n");
  29. else
  30. printf("NO\n");
  31. }
  32. return 0;
  33. }
  34.