Advertisement
Saleh127

CF 1399A

Aug 6th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. ios_base::sync_with_stdio(0);
  6. cin.tie(0);cout.tie(0);
  7.  
  8. int t;
  9. cin>>t;
  10. while(t--)
  11. {
  12. int a[20000],c,d=0,e,f,i,k;
  13. cin>>c;
  14. for(i=0;i<c;i++)
  15. {
  16. cin>>a[i];
  17. }
  18. sort(a,a+c);
  19. for(i=0;i<c-1;i++)
  20. {
  21. if(a[i+1]-a[i]>1)
  22. {
  23. d=1;
  24. }
  25. }
  26. if(d) cout<<"NO"<<endl;
  27. else cout<<"YES"<<endl;
  28. }
  29.  
  30.  
  31. return 0;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement