Submission #469404

#TimeUsernameProblemLanguageResultExecution timeMemory
469404ala2Anagramistica (COCI21_anagramistica)C++14
0 / 110
17 ms31936 KiB
#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)

anagramistica.cpp: In function 'void f(int)':
anagramistica.cpp:26:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         for(int u=0;u<vv.size()-1;u++)
      |                     ~^~~~~~~~~~~~
anagramistica.cpp:28:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |             for(int o=u+1;o<vv.size();o++)
      |                           ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...