# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
96541 | Kastanda | Genetics (BOI18_genetics) | C++11 | 2056 ms | 11844 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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);
for (int i = 1; i <= n; i++)
{
random_shuffle(P + 1, P + n + 1);
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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |