Submission #80660

#TimeUsernameProblemLanguageResultExecution timeMemory
80660FutymyCloneGenetics (BOI18_genetics)C++14
27 / 100
2080 ms6904 KiB
#include <bits/stdc++.h>

using namespace std;

const int N = 4105;

int n, m, k;
string a[N];
bitset <N> bs[N][4];

int toint (char c) {
    if (c == 'A') return 0;
    if (c == 'C') return 1;
    if (c == 'G') return 2;
    return 3;
}

int solve (int i, int j) {
    int ans = bs[i][0].count() - (bs[i][0] & bs[j][0]).count();
    ans = ans + bs[i][1].count() - (bs[i][1] & bs[j][1]).count();
    ans = ans + bs[i][2].count() - (bs[i][2] & bs[j][2]).count();
    ans = ans + bs[i][3].count() - (bs[i][3] & bs[j][3]).count();
    return ans;
}

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n >> m >> k;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < a[i].length(); j++) {
            bs[i][toint(a[i][j])].set(j);
        }
    }

    for (int i = 1; i <= n; i++) {
        bool ok = true;
        for (int j = 1; j <= n; j++) {
            if (i == j) continue;
            if (solve(i, j) != k) {
                ok = false;
                break;
            }
        }

        if (ok) return cout << i, 0;
    }
    return 0;
}

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:31:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int j = 0; j < a[i].length(); 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...