Submission #153121

#TimeUsernameProblemLanguageResultExecution timeMemory
153121SwanGenetics (BOI18_genetics)C++14
27 / 100
2083 ms2936 KiB
#include <bits/stdc++.h>
#define stop system("pause")
#define INP freopen("input.txt","r",stdin)
#define OUTP freopen("solve1.txt","w",stdout)
#define int long long
using namespace std;

typedef long long ll;

int cmp(string a,string b){
    int res = 0;
    for(int i(0); i < a.size();i++){
        if(a[i]!=b[i])res++;
    }
    return res;
}

main()
{
    ios_base::sync_with_stdio(0);
    int n,m,k; cin >> n >> m >> k;
    vector<string> v;
    for(int i(0); i < n;i++){
        string s; cin >> s;
        v.push_back(s);
    }
    for(int i(0); i < v.size();i++){
        bool f = 1;
        for(int j(0); j < v.size();j++){
            if(i == j)continue;
            int cnt = cmp(v[i],v[j]);
            if(cnt!=k){
                f = 0;
                break;
            }
        }
        if(!f)continue;
        cout << i+1;
        return 0;
    }
    return 0;
}
/*
*/

Compilation message (stderr)

genetics.cpp: In function 'long long int cmp(std::__cxx11::string, std::__cxx11::string)':
genetics.cpp:12:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i(0); i < a.size();i++){
                   ~~^~~~~~~~~~
genetics.cpp: At global scope:
genetics.cpp:18:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
genetics.cpp: In function 'int main()':
genetics.cpp:27:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i(0); i < v.size();i++){
                   ~~^~~~~~~~~~
genetics.cpp:29:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j(0); j < v.size();j++){
                       ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...