답안 #469404

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
469404 2021-08-31T21:45:24 Z ala2 Anagramistica (COCI21_anagramistica) C++14
0 / 110
17 ms 31936 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+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

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++)
      |                           ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 17 ms 31928 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 17 ms 31936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 17 ms 31928 KB Output isn't correct
2 Halted 0 ms 0 KB -