Saleh127

CF 1203b.cpp

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