fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t,c=0;
  6. cin >> t;
  7. int b = t;
  8. vector<int> v;
  9. while(t--)
  10. {
  11. int n;
  12. cin >> n;
  13. v.push_back(n);
  14. }
  15. for(int i=0;i<b-1;i++)
  16. {
  17. if(v[i]==v[i+1])
  18. {
  19. c++;
  20. }
  21. }
  22.  
  23. if(c == b-1)
  24. {
  25. cout << "YES" << endl;
  26. }
  27. else
  28. {
  29. cout << "NO" << endl;
  30. }
  31. return 0;
  32. }
Success #stdin #stdout 0s 5324KB
stdin
4
3 3 3 3


stdout
YES