Monday, September 16, 2019

Codeforce A. Yaroslav and Permutations

  1. #include< iostream >
  2. using namespace std;
  3. int main() {
  4. int n, x;
  5. cin >> n;
  6. int ar[10001] = {0};
  7. for(int i = 0; i < n; i++) {
  8. cin >> x;
  9. ar[x]++;
  10. if(ar[x] > (n+1)/2) return cout << "NO\n", 0;
  11. }
  12. cout << "YES\n";
  13. return 0;
  14. }

No comments: