-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathchef_got_recipes.cpp
More file actions
45 lines (39 loc) · 958 Bytes
/
chef_got_recipes.cpp
File metadata and controls
45 lines (39 loc) · 958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t,n,m,p;
cin>>t;
while(t--){
ll ar[32];
cin>>n;
for(int i=0;i<32;i++)ar[i]=0;
for(int i=1;i<=n;i++){
string s;
cin>>s;
int mask=0;
for(auto c:s){
if(c=='a') mask=mask|(1<<0);
if(c=='e') mask=mask|(1<<1);
if(c=='i') mask=mask|(1<<2);
if(c=='o') mask=mask|(1<<3);
if(c=='u') mask=mask|(1<<4);
}
ar[mask]++;
}
ll res=0;
for(int i=1;i<32;i++){
for(int j=i+1;j<32;j++){
if((i|j)==31){
res=res+ar[i]*ar[j];
}
}
}
res+=(ar[31]*ar[31]/2);
cout<<res<<'\n';
}
return 0;
}