Submission #984445

#TimeUsernameProblemLanguageResultExecution timeMemory
984445Mizo_CompilerGenetics (BOI18_genetics)C++17
46 / 100
2074 ms22096 KiB
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("popcnt")
typedef long long ll;
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) int(x.size())
const int N = 4100;
int n, m, k, id[30];
bitset<N> b[N][4];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> m >> k;
    id[int('A'-'A')] = 0;
    id[int('G'-'A')] = 2;
    id[int('T'-'A')] = 3;
    id[int('C'-'A')] = 1;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < m; j++) {
            b[i][id[int(s[j]-'A')]][j] = true;
        }
    }
    for (int i = 0; i < n; i++) {
        bool f = true;
        for (int j = 0; j < n && f; j++) {
            if (j == i)continue;
            int cnt = 0;
            for (int kk = 0; kk < 4; kk++) {
                cnt += (b[i][kk] & b[j][kk]).count();
            }
            f &= (cnt == m-k);
        }
        if (f) {
            cout << i+1;
            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...