# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
997761 | MarwenElarbi | Genetics (BOI18_genetics) | C++17 | 1925 ms | 56120 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 optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
#define fi first
#define se second
#define ll long long
#define pb push_back
#define ii pair<int,int>
const int nax=4100;
vector<bitset<nax*4>> b (nax);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main(){
int n,m,k;
cin>>n>>m>>k;
string tab[n];
vector<int> per(n);
for (int i = 0; i < n; ++i)
{
per[i]=i;
cin>>tab[i];
for (int j = 0; j < m; ++j)
{
if(tab[i][j]=='A') b[i][j*4]=1;
else if(tab[i][j]=='C') b[i][j*4+1]=1;
else if(tab[i][j]=='T') b[i][j*4+2]=1;
else b[i][j*4+3]=1;
}
}
bool vis[n];
memset(vis,0,sizeof vis);
int cnt=0;
for (int i = 0; i < n; ++i)
{
if(vis[i]==1) continue;
shuffle(per.begin(),per.end(),rng);
for (int j = 0; j < n; ++j)
{
if(per[j]==i) continue;
auto cnt=b[i]^b[per[j]];
int cur=cnt.count();
//cout <<i<<" "<<j<<" "<<cur<<endl;
if(cur/2!=k){
vis[per[j]]=1;
vis[i]=1;
break;
}
}
if(vis[i]==0){
cout <<i+1<<endl;
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... |