Submission #878122

#TimeUsernameProblemLanguageResultExecution timeMemory
878122vjudge1Genetics (BOI18_genetics)C++17
27 / 100
2085 ms14812 KiB
#include <bits/stdc++.h>
using namespace std;

#define ll long long 
#define pb push_back

const int N = 4100 + 4;

int n, m, k;
char s[N][N];
bitset<N> tmp, a[N], g[N], c[N], t[N];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    bool AC = true;

    cin >> n >> m >> k;
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
        for (int j = 0; j < m; ++j) {
            if (s[i][j] == 'A') {
                a[i][j] = true;
            }
            else if (s[i][j] == 'G') {
                g[i][j] = true;
            }
            else if (s[i][j] == 'C') {
                c[i][j] = true;
            }
            else if (s[i][j] == 'T') {
                t[i][j] = true;
            }
        }
    }

    for (int i = 0; i < n; ++i) {
        int cntOk = 0;
        for (int j = 0; j < n; ++j) {
            if (i == j) {
                continue;
            }

            int cnt = 0;
            tmp = a[i] & a[j];
            cnt += tmp.count();
            tmp = g[i] & g[j];
            cnt += tmp.count();
            tmp = c[i] & c[j];
            cnt += tmp.count();
            tmp = t[i] & t[j];
            cnt += tmp.count();

            // cout << i + 1 << ' ' << j + 1 << ' ' << cnt << '\n';

            cntOk += (m - cnt == k);
        }
        if (cntOk == n - 1) {
            cout << i + 1;
            return 0;
        }
    }

    return 0;
}

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:17:10: warning: unused variable 'AC' [-Wunused-variable]
   17 |     bool AC = true;
      |          ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...