Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define d(x) cout << #x << " = " << (x) << endl;
- #define fr freopen("in.txt", "r", stdin);
- #define fw freopen("out.txt", "w", stdout);
- #define mem(x) memset((x), 0, sizeof((x)));
- #define pb push_back
- #define LL long long
- #define fastIO ios_base::sync_with_stdio(false)
- #define sf scanf
- #define pf printf
- #define sc1(x) scanf("%d", &x)
- #define sc2(x, y) scanf("%d %d", &x, &y)
- #define sc3(x, y, z) scanf("%d %d %d", &x, &y, &z)
- #define FOR(i, x, y) for(int i=int(x); i<int(y); i++)
- #define ROF(i, x, y) for(int i=int(x-1); i>=int(y); i--)
- #define all(c) c.begin(), c.end()
- #define unq(v) sort(all(v)), (v).erase(unique(all(v)),v.end())
- #define siz 1000000
- #define MAX 100000
- vector<LL> edge[MAX];
- vector<LL> cost;
- vector<LL> visited(MAX);
- vector<LL> dist;
- LL ans = 0;
- LL taka = INT_MAX;
- #define mod 7901
- map<int, int> mymap;
- int facto(int n){
- int fact = 1;
- for(int i = 1; i <= n; i++){
- fact = (fact * i)%mod;
- }
- return fact%mod;
- }
- main(){
- fastIO;
- fr; fw;
- int tc;
- cin >> tc;
- for(int tr = 1; tr <= tc; tr++){
- //clearing map in every iteration
- mymap.clear();
- int n;
- cin >> n;
- int ara[n];
- //Global <int, int> maps has 0 decraled as default in value side of key-value pair
- FOR(i, 0, n) {
- cin >> ara[i];
- mymap[ara[i]]++;
- }
- int ans = 1;
- //traversing through map using auto loop
- for(auto p: mymap){
- ans = (ans*facto(p.second))%mod;
- }
- cout << ans%mod << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement