Submission #80661

#TimeUsernameProblemLanguageResultExecution timeMemory
80661FutymyCloneGenetics (BOI18_genetics)C++14
27 / 100
2097 ms9464 KiB
#include <bits/stdc++.h>

using namespace std;

const int N = 4105;

int n, m, k;
char a[N][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(){
    scanf("%d %d %d", &n, &m, &k);
    for (int i = 1; i <= n; i++) scanf("%s", a[i]);
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < m; 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 !printf("%d", i);
    }
    return 0;
}

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:27:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d", &n, &m, &k);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
genetics.cpp:28:39: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for (int i = 1; i <= n; i++) scanf("%s", a[i]);
                                  ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...