Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define _test int _TEST; cin>>_TEST; while(_TEST--)
- int main()
- {
- _test
- {
- int n;
- cin>>n;
- vector<ll int> a(n);
- for(auto &e: a) cin>>e;
- map<ll int, int> cnt;
- for(auto e: a)
- {
- for(ll int i=2; i*i<=e; i++)
- {
- while(e%i == 0)
- {
- cnt[i]++;
- e /= i;
- }
- }
- if(e > 1) cnt[e]++;
- }
- int f = 1;
- for(auto [x ,y]: cnt)
- f &= (y%n == 0);
- if(f) cout<<"YES\n";
- else cout<<"NO\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment