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>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
using namespace std;
const int N = 4100 + 10;
int n, m, k, cnt[N], diff[N][N];
char c[] = {'A', 'C', 'G', 'T'};
string s[N];
bitset<N> a[N];
int main() {
ios:: sync_with_stdio(0), cin.tie(0);
cin >> n >> m >> k;
for (int i = 0; i < n; i++) cin >> s[i];
for (int l = 0; l < 4; l++) {
for (int i = 0; i < n; i++) {
a[i].reset();
for (int j = 0; j < m; j++)
if (s[i][j] == c[l]) a[i][j] = 1;
}
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++)
if (diff[i][j] <= 2 * k) diff[i][j] += (a[i] ^ a[j]).count();
}
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++)
if (diff[i][j] == 2 * k) cnt[i]++, cnt[j]++;
for (int i = 0; i < n; i++)
if (cnt[i] == n - 1) {
cout << i + 1 << '\n';
break;
}
return 0;
}
Compilation message (stderr)
genetics.cpp: In function 'int main()':
genetics.cpp:30:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
30 | for (int i = 0; i < n; i++)
| ^~~
genetics.cpp:35:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
35 | return 0;
| ^~~~~~| # | 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... |