Source code for submission s539

fn.cpp

  1. #include <algorithm>
  2. #include <cmath>
  3. #include <cstdio>
  4. #include <cstdlib>
  5. #include <iostream>
  6. #include <sstream>
  7. #include <map>
  8. #include <set>
  9. #include <queue>
  10. #include <vector>
  11. #include <cstring>
  12.  
  13. using namespace std;
  14.  
  15. #define FOR(prom, a, b) for(int prom = (a); prom < (b); prom++)
  16. #define FORD(prom, a, b) for(int prom = (a); prom > (b); prom--)
  17. #define FORDE(prom, a, b) for(int prom = (a); prom >= (b); prom--)
  18.  
  19. #define PB push_back
  20. #define MP make_pair
  21.  
  22. #define MM(co, cim) memset((co), (cim), sizeof((co)))
  23.  
  24. #define DEB(x) cerr << ">>> " << #x << " : " << x << endl;
  25.  
  26. int p[10005];
  27.  
  28. int main ()
  29. {
  30. int m,n,a,b;
  31. while(cin >> n >> m){
  32. MM(p,0);
  33. FOR(i,0,m){
  34. cin >> a >> b;
  35. p[a-1] ++;
  36. p[b-1] ++;
  37.  
  38.  
  39. }
  40. bool ok = false;
  41. FOR(i,0,n)
  42. if(p[i] >= 4){
  43. ok = true;
  44. break;
  45. }
  46.  
  47. if(ok)
  48. cout << "YES" << endl;
  49. else
  50. cout << "NO" << endl;
  51. }
  52.  
  53. return 0;
  54. }
  55.