Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define boAshraf ios_base::sync_with_stdio(false); cin.tie(NULL);
- #define ll long long
- #define sz(s) (int)(s).size()
- #define all(s) (s).begin(),(s).end()
- using namespace std;
- void File();
- void sol();
- const int mod=7901;
- int mul(int a,int b){
- return a*b%mod;
- }
- const int N=1001;
- int fact[N];
- void pre(){
- fact[0]=1;
- for(int i=1;i<N;i++)fact[i]=mul(i,fact[i-1]);
- }
- int main() {
- boAshraf
- File();
- pre();
- int t = 1;
- cin >> t;
- while (t--) {
- sol();
- }
- return 0;
- }
- void sol() {
- int ans=1;
- int n;
- cin>>n;
- map<int,int>mp;
- for(int i=0;i<n;i++){
- int x;cin>>x;mp[x]++;
- }
- for(auto [f,s]:mp)ans=mul(ans,fact[s]);
- cout<<ans<<'\n';
- }
- void File() {
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- }
Advertisement
Add Comment
Please, Sign In to add comment