Source code for submission s970

fn.cpp

  1.  
  2. #include <cstdlib>
  3. #include <cstdio>
  4. #include <cstring>
  5. #include <cmath>
  6.  
  7. using namespace std;
  8.  
  9. int main() {
  10. int n, m;
  11. while (scanf("%d %d", &n, &m) == 2) {
  12. bool bunny = false;
  13. int *paws = new int[n];
  14. memset(paws, 0, n*sizeof(int));
  15. for (int i = 0; i < m; i++) {
  16. int x, y;
  17. scanf("%d %d", &x, &y);
  18. x--, y--;
  19. paws[x]++;
  20. paws[y]++;
  21. if (paws[x] == 4) bunny = true;
  22. if (paws[y] == 4) bunny = true;
  23. }
  24. printf(bunny ? "YES\n" : "NO\n");
  25. }
  26. return 0;
  27. }
  28.  
  29.