# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
501260 | RGBB | Genetics (BOI18_genetics) | C++14 | 2041 ms | 60828 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 <iostream>
#include <bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;
const int MAX=4100;
int n,m,k;
bool flag[MAX],check[MAX][MAX];
bitset<MAX>col[MAX][4];
bitset<MAX>temp;
int cnt;
vector<int>ind;
string inp[MAX];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n>>m>>k;
k*=2;
ind=vector<int>(n);
for(int i=0;i<n;i++){
cin>>inp[i];
ind[i]=i;
}
random_shuffle(ind.begin(),ind.end());
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(inp[ind[i]][j]=='A')col[i][0][j]=1;
else if(inp[ind[i]][j]=='C')col[i][1][j]=1;
else if(inp[ind[i]][j]=='G')col[i][2][j]=1;
else col[i][3][j]=1;
}
}
for(int i=0;i<n;i++){
if(flag[i])continue;
bool villain=true;
for(int j=0;j<n;j++){
if(j==i)continue;
if(check[i][j])continue;
check[j][i]=true;
cnt=0;
cnt+=(col[i][0]^col[j][0]).count();
cnt+=(col[i][1]^col[j][1]).count();
cnt+=(col[i][2]^col[j][2]).count();
cnt+=(col[i][3]^col[j][3]).count();
if(cnt!=k){
villain=false;
flag[j]=true;
break;
}
}
if(villain){
cout<<ind[i]+1<<"\n";
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... |