# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
469405 | 2021-08-31T21:46:58 Z | ala2 | Anagramistica (COCI21_anagramistica) | C++14 | 19 ms | 31852 KB |
#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) 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 19 ms | 31820 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 17 ms | 31852 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 19 ms | 31820 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |