Submission #984464

#TimeUsernameProblemLanguageResultExecution timeMemory
984464Mizo_CompilerGenetics (BOI18_genetics)C++17
46 / 100
2085 ms42508 KiB
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast,unroll-loops")
//#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], c[N][N], lim = 4;
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 j = i-1; j >= 0; j--) {
            for (int kk = 0; kk < lim; kk++) {
                c[i][j] += (b[i][kk] & b[j][kk]).count();
            }
            c[j][i] = c[i][j];
        }
    }
    for (int i = 0; i < n; i++) {
        bool f = true;
        for (int j = 0; j < n && f; j++) {
            if (j == i)continue;
            f &= (c[i][j] == 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...