# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
469404 | ala2 | Anagramistica (COCI21_anagramistica) | C++14 | 17 ms | 31936 KiB |
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;
string s[1010000];
vector<string>v;
map<string , int>m;
const int mod=1e9+7;
int fact[1000100];
vector<string>vv;
int hh=0; int k,n;
int y=0; int wq;
void f(int i)
{ //cout<<" "<<hh<<" "<<i<<endl;
y++;
if(y>=wq+8)
return;
if(i>n)
return ;
if(i>=n)
{ // cout<<" "<<"KK"<<endl;
// for(int k=0;k<vv.size();k++)
// cout<<vv[k]<<" ";
//cout<<endl;
int b=0;
for(int u=0;u<vv.size()-1;u++)
{
for(int o=u+1;o<vv.size();o++)
{
if(vv[o]==vv[u])
b++;
}
}//cout<<" "<<b<<endl;
if(b==k)
{ //cout<<" 1 "<<b<<endl;
hh++;
}
return;
}
if(i<n){
vv.push_back(s[i]);
f(i+1);
vv.pop_back();
f(i+1);
}
// cout<<" KK"<<endl;
return ;
}
int main()
{
cin>>n>>k;
wq=pow(2,n);
fact[1]=1;
for(int i=0;i<n;i++)
{
cin>>s[i];
sort(s[i].begin(),s[i].end());
}
sort(s,s+n);
f(0);
// cout<<" : "<<endl;
cout<<hh<<endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |