# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
80660 | FutymyClone | Genetics (BOI18_genetics) | C++14 | 2080 ms | 6904 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;
string a[N];
bitset <N> bs[N][4];
int toint (char c) {
if (c == 'A') return 0;
if (c == 'C') return 1;
if (c == 'G') return 2;
return 3;
}
int solve (int i, int j) {
int ans = bs[i][0].count() - (bs[i][0] & bs[j][0]).count();
ans = ans + bs[i][1].count() - (bs[i][1] & bs[j][1]).count();
ans = ans + bs[i][2].count() - (bs[i][2] & bs[j][2]).count();
ans = ans + bs[i][3].count() - (bs[i][3] & bs[j][3]).count();
return ans;
}
int main(){
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin >> n >> m >> k;
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i <= n; i++) {
for (int j = 0; j < a[i].length(); j++) {
bs[i][toint(a[i][j])].set(j);
}
}
for (int i = 1; i <= n; i++) {
bool ok = true;
for (int j = 1; j <= n; j++) {
if (i == j) continue;
if (solve(i, j) != k) {
ok = false;
break;
}
}
if (ok) return cout << i, 0;
}
return 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... |