# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
942476 | vjudge1 | Anagramistica (COCI21_anagramistica) | C++17 | 1060 ms | 460 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;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
long long n, m;
cin>>n>>m;
vector<string> s(n);
for(long long i = 0; i < n; i++){
cin>>s[i];
sort(s[i].begin(), s[i].end());
}
long long Contador = 0;
for(long long i = 0; i < (1LL<<n); i++){
long long Flecha = 0;
long long Pares = 0;
bool Continuar = 1;
for(long long aaa = 0; aaa <= n + 2; aaa++) if(i == (1LL<<aaa)){
Continuar = 0;
break;
}
if(i != 0 and Continuar){
vector<string> Verificar;
for(long long j = 0; j < n; j++){
if(i & (1LL<<Flecha)) Verificar.push_back(s[j]);
Flecha++;
}
for(long long j = 0; j < Verificar.size() - 1; j++){
for(long long k = j + 1; k < Verificar.size(); k++){
if(Verificar[j] == Verificar[k]) Pares++;
}
}
}
if(Pares == m) Contador++;
}
cout<<Contador;
return 0;
}
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... |