# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
379997 | couplefire | Genetics (BOI18_genetics) | C++17 | 2090 ms | 41580 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;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
int n, m, k;
pair<array<bitset<4105>, 4>, int> arr[4105];
char bruh[4105][4105]; //A:0, G:1, C:2, T:3
int main(){
// freopen("a.in", "r", stdin);
scanf("%d %d %d", &n, &m, &k);
srand(time(NULL));
for(int i = 0; i<n; ++i){
scanf("%s", bruh[i]);
// printf("%s \n", bruh[i], bruh[i]+m);
for(int j = 0; j<4; ++j) arr[i].first[j].reset();
arr[i].second = i;
for(int j = 0; j<m; ++j){
if(bruh[i][j] == 'A') arr[i].first[0].set(j);
else if(bruh[i][j] == 'G') arr[i].first[1].set(j);
else if(bruh[i][j] == 'C') arr[i].first[2].set(j);
else arr[i].first[3].set(j);
}
}
random_shuffle(arr, arr+n);
for(int i = 0; i<n; ++i){
bool work = true;
for(int j = 0; j<n; ++j){
if(j == i) continue;
int cnt = 0;
for(int a = 0; a<4; ++a){
cnt += (arr[i].first[a]&arr[j].first[a]).count();
}
// printf("%d \n", cnt);
if(cnt != m-k){
work = false;
break;
}
}
if(work){
printf("%d \n", arr[i].second+1);
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... |