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("Ofast,unroll-loops")
#pragma GCC target("avx2")
const int N = 4100 + 4;
int n, m, k;
bool done[N];
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) {
bool ok = true;
for (int j = i + 1; j < n; ++j) {
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';
if (m - cnt != k) {
ok = false;
done[j] = true;
}
}
if (ok == true && done[i] == false) {
cout << i + 1;
return 0;
}
}
return 0;
}
Compilation message (stderr)
genetics.cpp: In function 'int main()':
genetics.cpp:21:10: warning: unused variable 'AC' [-Wunused-variable]
21 | 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... |