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. cout << c << endl;
  22. if(c == t-1)
  23. {
  24. cout << "YES" << endl;
  25. }
  26. else
  27. {
  28. cout << "NO" << endl;
  29. }
  30. return 0;
  31. }
Success #stdin #stdout 0.01s 5272KB
stdin
4
3 3 3 3


stdout
0
NO