Submission #1228095

#TimeUsernameProblemLanguageResultExecution timeMemory
1228095minhpkGenetics (BOI18_genetics)C++20
47 / 100
1584 ms2708 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;

bitset<4101> t[4101];
int res[4101];

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int a, b, c;
    cin >> a >> b >> c;
    for (int i = 1; i <= a; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < b; j++) {
            t[i][j] = (s[j] == 'A' ? 0 : 1);
        }
    }

    for (int i = 1; i <= a; i++) {
        for (int j = i + 1; j <= a; j++) {
            if ((t[i] ^ t[j]).count() == c) {
                res[i]++;
                res[j]++;
            }
        }
    }

    for (int i = 1; i <= a; i++) {
        if (res[i] == a - 1) {
            cout << i << "\n";
            return 0;
        }
    }

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...