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