답안 #942474

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
942474 2024-03-10T17:22:00 Z vjudge1 Anagramistica (COCI21_anagramistica) C++17
0 / 110
1000 ms 604 KB
#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

anagramistica.cpp: In function 'int main()':
anagramistica.cpp:28:36: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |             for(long long j = 0; j < Verificar.size() - 1; j++){
      |                                  ~~^~~~~~~~~~~~~~~~~~~~~~
anagramistica.cpp:29:44: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |                 for(long long k = j + 1; k < Verificar.size(); k++){
      |                                          ~~^~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1045 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -