#include <bits/stdc++.h>
#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
signed main(){
fastio
int n,k;
cin >> n >> k;
vector<string> v;
for(int i = 0;i < n;i++){
string s;
cin >> s;
sort(s.begin(),s.end());
v.push_back(s);
}
int ans = 0;
for(int i = 0;i < (1<<n);i++){
map<string,int> m;
for(int j = 0;j < n;j++){
if(i&(1<<j)) m[v[j]]++;
}
int tmp = 0;
for(auto [a,b] : m){
tmp += b*(b-1)/2;
}
if(tmp==k) ans++;
}
cout << ans << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
2 ms |
312 KB |
Output is correct |
3 |
Correct |
6 ms |
204 KB |
Output is correct |
4 |
Correct |
8 ms |
204 KB |
Output is correct |
5 |
Correct |
30 ms |
308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
2 ms |
312 KB |
Output is correct |
3 |
Correct |
6 ms |
204 KB |
Output is correct |
4 |
Correct |
8 ms |
204 KB |
Output is correct |
5 |
Correct |
30 ms |
308 KB |
Output is correct |
6 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |