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. vector<int> v;
  8. while(t--)
  9. {
  10. int n;
  11. cin >> n;
  12. v.push_back(n);
  13. }
  14. for(int i=0;i<t-1;i++)
  15. {
  16. if(v[i]==v[i+1])
  17. {
  18. c++;
  19. }
  20. }
  21. if(c == t-1)
  22. {
  23. cout << "YES" << endl;
  24. }
  25. else
  26. {
  27. cout << "NO" << endl;
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0s 5324KB
stdin
4
3 3 3 3


stdout
NO