Source code for submission s507

fn.cpp

  1. #include <cstdio>
  2. #include <cstdlib>
  3. #include <cmath>
  4.  
  5. #include <string>
  6. #include <vector>
  7. #include <iostream>
  8.  
  9. using namespace std;
  10.  
  11. const static int MAX = 10050;
  12. int poi[MAX];
  13.  
  14.  
  15. bool load()
  16. {
  17. int points, lines;
  18. bool bunny = false;
  19.  
  20. if (scanf("%d%d", &points, &lines) != 2)
  21. return false;
  22.  
  23. for(int i=0; i<MAX; i++)
  24. poi[i] = 0;
  25.  
  26. for (int i = 0; i < lines; ++i)
  27. {
  28. int from, to;
  29. scanf("%d%d", &from, &to);
  30. poi[from]++;
  31. poi[to]++;
  32. if(poi[from] >=4 || poi[to] >=4)
  33. bunny = true;
  34.  
  35. }
  36. if(bunny)
  37. cout << "YES" << endl;
  38. else
  39. cout << "NO" << endl;
  40. return true;
  41. }
  42.  
  43. int main()
  44. {
  45. while (load()) {}
  46. return 0;
  47. }
  48.