Submission #96542

#TimeUsernameProblemLanguageResultExecution timeMemory
96542KastandaGenetics (BOI18_genetics)C++11
27 / 100
2033 ms4088 KiB
#include<bits/stdc++.h>
using namespace std;
const int N = 4105;
int n, m, k, P[N];
char A[N];
bitset < N > B[N][4];
inline int Diff(int i, int j)
{
    int diff = m;
    for (int w = 0; w <= 3; w ++)
        diff -= (B[i][w] & B[j][w]).count();
    return (diff);
}
int main()
{
    scanf("%d%d%d", &n, &m, &k);
    getchar();
    for (int i = 1; i <= n; i++, getchar())
    {
        for (int j = 1; j <= m; j++)
        {
            int ch = getchar();
            A[j] = ch;
            if (ch == 'A') ch = 0;
            else if (ch == 'C') ch = 1;
            else if (ch == 'G') ch = 2;
            else ch = 3;
            B[i][ch][j] = 1;
        }
    }
    srand(time(0));
    iota(P, P + n + 1, 0);
  	random_shuffle(P + 1, P + n + 1);
    for (int i = 1; i <= n; i++)
    {
        int j = 1;
        for (; j <= n; j++)
            if (i != P[j] && Diff(i, P[j]) != k)
                break;
        if (j > n)
            return !printf("%d\n", i);
    }
    assert(0);
}

Compilation message (stderr)

genetics.cpp: In function 'int main()':
genetics.cpp:16: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);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...