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;
#define ll long long
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
const int N = 4100 + 4;
int n, m, k;
char s[N][N];
bitset<N> tmp, a[N], g[N], c[N], t[N];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
bool AC = true;
cin >> n >> m >> k;
for (int i = 0; i < n; ++i) {
cin >> s[i];
for (int j = 0; j < m; ++j) {
if (s[i][j] == 'A') {
a[i][j] = true;
}
else if (s[i][j] == 'G') {
g[i][j] = true;
}
else if (s[i][j] == 'C') {
c[i][j] = true;
}
else if (s[i][j] == 'T') {
t[i][j] = true;
}
}
}
for (int i = 0; i < n; ++i) {
int cntOk = 0;
for (int j = 0; j < n; ++j) {
if (i == j) {
continue;
}
int cnt = 0;
tmp = a[i] & a[j];
cnt += tmp.count();
tmp = g[i] & g[j];
cnt += tmp.count();
tmp = c[i] & c[j];
cnt += tmp.count();
tmp = t[i] & t[j];
cnt += tmp.count();
// cout << i + 1 << ' ' << j + 1 << ' ' << cnt << '\n';
cntOk += (m - cnt == k);
}
if (cntOk == n - 1) {
cout << i + 1;
return 0;
}
}
return 0;
}
Compilation message (stderr)
genetics.cpp: In function 'int main()':
genetics.cpp:20:10: warning: unused variable 'AC' [-Wunused-variable]
20 | bool AC = true;
| ^~| # | 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... |