This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
long long n, k, f[2000010], cnt=0, mod=1e9+7, dp[2010], ans=0;
string S[2010];
unordered_map<string, long long> thutu;
long long modpow(int a, int b){
int s=a;
for(int i=1;i<=b;i++){
a*=s;
a%=mod;
}
return a;
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//freopen("anagramistica.inp", "r", stdin);
//freopen("anagramistica.out", "w", stdout);
cin>>n>>k;
for(int i=1;i<=n;i++){
cin>>S[i];
sort(S[i].begin(), S[i].end());
}
for(int i=1;i<=n;i++){
thutu[S[i]]++;
}
for(auto x : thutu){
f[x.second*(x.second-1)/2]++;
}
if(k==0){
long long ko=modpow(2, f[0]);
cout<<ko;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |